Get latest news and Web Designing tutoria

Friday, 29 May 2015

PHP and the Submit Button of HTML Forms

The HTML Submit button is used to submit form data to the script mentioned in the ACTION attribute. Here's ours:
<Form Name ="form1" Method ="POST" ACTION = "basicForm.php">
So the page mentioned in the ACTION attribute is basicForm.php. To Submit this script, you just need a HTML Submit button:
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login">

You don't need to do anything special with a Submit button – all the submitting is done behind your back. As long as SUBMIT has an ACTION set, then your data will get sent somewhere. But the NAME attribute of the Submit buttons comes in very handy. You can use this Name to test if the form was really submitted, or if the user just clicked the refresh button. This is important when the PHP script is on the same page as the HTML form. Our Submit button is called "Submit1", but you can call it almost anything you like.

Now that you know about METHOD, ACTION, and SUBMIT, we can move on to processing the data that the user entered. First, how to get values from our text box.

Related Posts:

  • Geting Values from Arrays Here's an example for you to try: <?php $seasons = array("Autumn", "Winter", "Spring", "Summer"); print $seasons[0]; ?> The array is the same one we set up before To get at what is inside of an array, just … Read More
  • PHP Arrays You know what a variable is – just a storage area where you hold numbers and text. The problem is, a variable will hold only one value. You can store a single number in a variable, or a single string. An array is like … Read More
  • How to Set up a PHP Array First you type out what you want your array to be called ($Order_Number, in the array above) and, after an equals sign, you type this: array( ); So setting up an array just involves typing the word array followed by a p… Read More
  • The PHP break statement There are times when you need to break out of a loop before the whole thing gets executed. Or, you want to break out of the loop because of an error your user made. In which case, you can use the break statement. Fortu… Read More
  • Sorting PHP Array values There may be times when you want to sort the values inside of an array. For example, suppose your array values are not in alphabetical order. Like this one: $full_name = array(); $full_name["Roger"] = "Wate… Read More

0 comments:

Post a Comment