Professional Documents
Culture Documents
Home
Java
Frameworks
Database
Technology
Web Development
Build/Test Tools
Servers
PHP
Home
Tutorial
Php
Phpbeginners
PHP Tutorial
Application * IPL 2012: Match Schedule and ground details Ask Questions?
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for. Ask your questions, our development team will try to give answers to your questions. 0
Like 2915 likes. Sign Up
Here we would integrate the HTML forms and PHP by creating HTML forms to collect the user input turning that input into variables, and then doing various things with the information that we just collected. Here we would integrate the HTML forms and PHP by creating HTML forms to collect the user input turning that input into variables, and then doing various things with the information that we just collected. First we create a form in HTML and call the file, just like: 1. <html> 2. 3. 4. 5. 6. 7. 8. 9. Your name is: <form action=Admissions.php method=post> <head> <title>Admission Form</title> </head> <body>
Tutorial Topics
Hibernate Framework Struts Framework Spring Framework XML Ajax JavaScript Java Web Services Database Technology Web Development PHP ( 1057 ) ( 836 ) ( 567 ) ( 196 ) ( 528 ) ( 109 ) ( 1806 ) ( 71 ) ( 145 ) ( 90 ) ( 503 ) ( 406 )
10. <br> <input type=text name=YourName> 11. 12. Your Address is: 13. <br /><input type=text name=Address> 14. 15. 16. <input type=submit name=submit value=Correct!> 17. </form>
converted by Web2PDFConvert.com
17. </form> 18. 19. </body> 20. </html> This is a regular HTML form in which:
In line 7, the Form action of HTML command reads action= Admissions.php and directs the browser of which PHP document will process the results of the form. A document will be created named Admissions.php which generates the result page. In line 10, input type=text determines that the form element which we want here is text or a text box (we could also have a radio button, check box, etc.), name=YourName determines that whatever the user types into the text box will become a variable that is coded as "YourName." This is what ties together forms and variables - each form field can set a variable to be used however you want. Similar in line 13, you there is have another text input and name that will recall the address of the applicant to fill in. Line 16, 17: This code makes a submit button with the text Correct and ends the form. So this form will collect the variable user's name and address. 3.6.1. The $_GET Function The inbuilt $_GET function is used for collecting values from a form sent with method= get. The advantage of using GET function is that it is visible to everyone and can be seen on the URL. It can also be bookmark for further used. For example: <form action=Admission.php method=get> Name: <input type=text name=fname/> Age: <input type= textname=age /> <input type=submit/> </form> When the user clicks on Submit button, the URL sent to the server could look something like this: http://www.roseindia/Admission.php?fname=Justin&age=25 Now the $_GET function can be used to collect form data like this: Admission <?php echo $_GET["fname"]; ?>!<br /> You are <?php echo $_GET[age]; ?> years old! 3.6.2. The $_POST Function The $_POST Function is also used for collecting values from a form sent with method=post but unlike $_GET function, the built-in $_POST function is invisible for the end users and has a maximum limitation of 8 MB size but it can be enhanced by setting the post_max_size in the php.ini file; e.g. <form action=Admission.php method=post> Name: <input type=text name=fname /> Age: <input type=text name=age /> <input type=submit /> </form> When the user clicks the Submit button, the URL will look like this: http://www.roseindia.net/admission.php Now, using $_POST function, the data can be collected from collect form field. Admission <?php echo $_POST[fname]; ?>!<br /> You are <?php echo $_POST[age]; ?> years old. 3.6.3. The PHP $_REQUEST Function
Ads by Google
Ads by Google
converted by Web2PDFConvert.com
The inbuilt $_REQUEST function contains the contents of both $_GET, $_POST, and $_COOKIE, so it works for collecting form data sent with both the GET and POST methods. For Example: Admission <?php echo $_REQUEST[fname]; ?>!<br /> You are <?php echo $_REQUEST[age]; ?> years old. Related Tags for HTML Forms and PHP: Previous Index Next
Services
Software Solutions
JSF Development Outsourcing ERP M-Commerce Flex Development
Website Development
Web Designing Web Redesigning Web Development Logo Design Web Design Packages Domain Registration
Content Development
Content Development Article Writing Blog Writing News Writing SEO Copywriting Technical Documentation Article Marketing
E-Commerce Solutions
CRM
Home
Privacy Policy
converted by Web2PDFConvert.com