Lee-Bartlett Posted August 14, 2008 Share Posted August 14, 2008 Hi i just started to learn php and it is hard to say the least atm i got a basic form where i want to send the data in the feilds to my email adress. the two forms are (php form) <htm> <head> <title>Untitled Document</title> </head> <body> <?php $email = $HTTP_POST_VARS['[email protected]']; $subject = $HTTP_POST_VARS['test']; $message = $HTTP_POST_VARS['message']; ?> </body> </html> and the form <html> <head> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" action="mail.php" method="post" > Name <label> <input type="text" name="Username" id="Username" /> </label> <p>DOB <label> <input type="text" name="DOB" id="DOB" /> </label> </p> <p>Age <label> <input type="text" name="AGE" id="AGE" /> </label> </p> <p> <label for="button"></label> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> </body> </html> can someone please tell me where i might be going wrong or what i missed. (I found some code online and tried to implement it with mine) Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/ Share on other sites More sharing options...
budimir Posted August 14, 2008 Share Posted August 14, 2008 What exactly are you doing and where is the problem? The form is OK, and the variables are OK. But, what should it do? Sorry. There is a problem with the variables: In the = $_POST["here goes the name of the input field from the form"] Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616370 Share on other sites More sharing options...
JasonLewis Posted August 14, 2008 Share Posted August 14, 2008 You're not actually mailing it anywhere, look at mail(). Also, avoid using $HTTP_POST_VARS, it is deprecated. Use $_POST instead. Oh and looking at your PHP page, it's not making much sense. You don't actually call any of the variables in the form. <?php $email = "[email protected]"; //get post variables $username = $_POST['Username']; $dob = $_POST['DOB']; $age = $_POST['AGE']; //then put in your mail function ?> Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616373 Share on other sites More sharing options...
Lee-Bartlett Posted August 14, 2008 Author Share Posted August 14, 2008 Ok changed the varibles but not sure how to link my email adrss to it Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616379 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 To send an email with PHP you'd use mail Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616432 Share on other sites More sharing options...
fri3ndly Posted August 14, 2008 Share Posted August 14, 2008 To make it nice and easy for you: mail($emailtogoto, $subject, $message, 'From: [email protected]'); You should have a look at php.net though, its very useful! Try killerphp.com and phpvideotutorials.com to as these are very good for beginners Quote Link to comment https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616438 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.