Jump to content

taking inputs


bal bal

Recommended Posts

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 = "[email protected]";
# $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>

Link to comment
https://forums.phpfreaks.com/topic/132656-taking-inputs/
Share on other sites

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) ;

Link to comment
https://forums.phpfreaks.com/topic/132656-taking-inputs/#findComment-689930
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.