Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

php forms

Sun Oct 05, 2008 9:18 pm

If you want to take data from the user you will need to do form to user entry .For example if you want to take the mail of visitor what you will do ? :grin: .you will do a form .the html of the form will be like the following :

Code:

 
<html>
 <form action='email.php' method='post'>
 <strong>Email:</strong><input type='text' name='email' size='50' maxlength='50' /><br/>
<
input type='submit' value='submit' />
</
form>
</
html>
 


In the preview code , you are sending a parameter 'email' to a page email.php .you are posting this parameter in the http request to the server .

in the email.php page you can receive this parameter using the function $_POST['paramtername'] .the paramter name here is email . here is the code :
Code:

<html>
<?php
  
   $visitoremail
=$_POST['email'];
   echo "your email is $visitoremail";

?>
</html>


The output from this code depend on the user enter .Assume the the entered email is [email protected] . So the output will be :
Code:

your email is admin
@codemiles.com


any problems send to me a private massage .
Thank you ,



Post a reply
  Related Posts  to : php forms
 Using forms with ASP     -  
 Secure forms without using captcha     -  
 Multipart HTTP forms submitter - With Progress Information     -  

Topic Tags

PHP Forms