This tutorial explains how to use multiple submit buttons in a HTML form and have PHP handle it. Usually a HTML form has only one submit button but there are situations when you might need to use more than one submit buttons and have PHP check which button has been pressed and an action to be done according to the button pressed. Having multiple submit buttons and handling them through PHP is just a matter of checking the the name of the button with the corresponding value of the button using conditional statements.Continue Reading…
Using the Apache Redirect directive
Redirecting to another URL and passing the correct HTTP headers is extremely useful from SEO point of view if you migrate your website/blog from one URL to another. Other than redirecting to URL you can also use the redirect directive to send certain HTTP status codes when a page is accessed. The Redirect directive can be used in both the httpd.conf file as well as .htaccess file.Continue Reading…
How to display IP Address in PHP
PHP can be used to get the IP Address of a website visitor, IP address of the server hosting the website and resolve the IP address to get the hostname a.k.a reverse DNS records. PHP has predefined $_SERVER array variable using which IP addresses of both visitors and host can be retrieved. The gethostbyaddr() function is used to find out the hostname. The indices REMOTE_ADDR and HTTP_HOST contain the visitor IP address and host IP addressContinue Reading…
Change Home Directory in Linux
Change the home directory of a Linux user with a simple usermod command. While creating a user if you didn’t specify any –home parameter Linux assumes the home directory of the user to be /home/username even if you did specify you can later change it to something else according to your needs. Apart from changing the home directory using the usermod command you’ll have to assign proper ownership and permissions to the new folder. You can also change the home directory by editing the /etc/passwd file. I’ll outline both the steps here.Continue Reading…
Reset Root Password in Linux
Reset your Linux root user a.k.a. superuser password by going to single user mode. Its simple even for newbies who dread the command line. It always happens that you forget the Linux root user password and fumble about without knowing what to do. I’ll outline the steps to reset root password on both redhat variants (fedora, Mandriva) and Debian (Knoppix, Ubuntu) variants. And also tell you how to overcome certain errors you might face while doing so.Continue Reading…
Javascript Reload Image
Using Javascript you can reload an image without reloading the page. This is extremely useful for reloading a captcha image if the user is unable to read the characters shown in it. Reloading an image using Javascript is just a simple matter of reassigning the same image location to the image src attribute. But the problem is the browser doesn’t call the image from the web server, since the name is same the browser just fetches the same image from the cache (Temporary Internet Files). So to overcome this we must add something with the image src attribute in such a way that it doesn’t affect the image location. The best way to do it is to add it like a query string to the image.Continue Reading…
- « Previous Page
- 1
- …
- 15
- 16
- 17
- 18
- 19
- …
- 25
- Next Page »