bal bal Posted November 14, 2008 Share Posted November 14, 2008 hiya I have written this to get some input from the user as form input and send me mail, I can get input from 2 fields but can't take the input from the rest, can anyone please help me to solve the problem? here is the php code and html code as well. # <?php # $to = "protecty@gmail.com"; # $subject = "php email test"; # # $name = $_REQUEST['name'] ; # $ans = $_REQUEST['txtq'] ; # $ans2 =$_POST['msg']; # # $headers = "From: $name"; # $sent = mail($to, $subject, $ans, $ans2, $headers) ; # if($sent) # {print "Your mail was sent successfully"; } # else # {print "Sorry, an error occure, can't send your mail"; } # ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #7996B1; } --> </style></head> <body> <form id="form1" name="form1" method="post" action="ques.php"> <p>Enter your name here <label> <input name="name" type="text" id="name" size="40" /> </label> </p> <p> </p> <p>Q1. What other features you want to see in this site? (example: email, help, forum etc.)</p> <p> <label> <textarea name="txtq" id="txtq" cols="45" rows="5"></textarea> </label> </p> <p> <label>Q3. Any recommand for this website... (any other related useful topics)<br /> <br /> <textarea name="msg" cols="45" rows="5" id="msg"></textarea> </label> </p> <p>Select anyone please</p> <p> <label> <input type="radio" name="radio" id="radio_tall" value="radio_tall" /> Tall</label> </p> <p> <label> <input type="radio" name="radio" id="radio_short" value="radio_short" /> Short</label> </p> <p> <label> <input type="submit" name="submit" id="submit" value="Submit" /> </label> </p> </form> <p> </p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/132656-taking-inputs/ Share on other sites More sharing options...
Maq Posted November 14, 2008 Share Posted November 14, 2008 First of all this is a bad section to post in... Second, what fields are working, what aren't? For starters instead of using REQUEST use the POST method like you state for your method in your HTML. You should be concatenating/formatting the body into 1 variable to pass through... Right now you have $ans & $ans2, which I don't think will work properly. # $sent = mail($to, $subject, $ans, $ans2, $headers) ; Quote Link to comment https://forums.phpfreaks.com/topic/132656-taking-inputs/#findComment-689930 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.