Forum Moderators: coopster

Message Too Old, No Replies

php form not submitting

can't get new fields to submit with the other fields

         

jman123

7:10 am on Mar 3, 2007 (gmt 0)

10+ Year Member



Hi,

I'm an html guy and I'm trying to add onto someone else's php coding – and I can’t figure it out.

Basically, I want to add multiple fields to the form, but how do I code that on the php script side? I tried to just copy and paste the code, and rename some of the variables, but that doesn’t work.

Here is the script:
----------------------------------------------------------
<?php
$Que=array();
$Que[0]="Do you know the demand curve and price elasticity of your main products?";
$Que="Do you often create bundles and special editions of your products for particular market segments?";
$Que[2]="Have you identified distinct market segments, and do you serve these market segments, products, and services at different price points?";
$Que[3]="Do you know what attributes of your products and services drive buying decisions and control their willingness to pay?";

if($_REQUEST['btnSubmit']=='Submit')
{
$Ans=array();
$Email=$_REQUEST['txtEmail'];
$Message .="<table width=100% cellpadding=3 style=' font-family:verdana; font-size:10px;' >
<tr ><td colspan=2><b><Font face=verdana size=3>Price Quiz</span></b><br><br></td></tr>
<tr ><td colspan=2>&nbsp;&nbsp;&nbsp;&nbsp;Sender's Email Address: <b>$Email </b><br><br></td></tr>";
for($i=0,$c=1;$i<count($Que);$i++,$c++)
{
$Nm="rdb".$i;

if($_REQUEST[$Nm]==0) { $Ans[$i]="Yes"; }else{ $Ans[$i]="No"; }
$Message .="<tr><td width=10></td><td ><b>$c. </b>&nbsp;".$Que[$i]."<br><b>A:</b>&nbsp;".$Ans[$i]."</td></tr><tr><td>&nbsp;</td></tr>";
}

$Message .="</table>";
//--------------address of receiver---------------
$To="email@example.com";

$From=$Email;
$headers.="MIME-Version:1.0"."\r\n";
$headers.="content-type:text/html; charset=iso-8859-1"."\r\n";
$headers.="TO:$To"."\r\n";$headers.="From:$Email"."\r\n";
$Sub="Price Quiz ";

if(@mail($To,$Sub,$Message,$headers))
{
$Msg="Mail has been sent successfully";
$_REQUEST['txtEmail']="";
}
else $Msg="Sorry, the email could not be sent!";

}
?>

Thank you so much for any help

[1][edited by: jatar_k at 12:49 pm (utc) on Mar. 3, 2007]
[edit reason] removed html as not needed [/edit]

dreamcatcher

3:17 pm on Mar 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi jman123,

Basically all your new vars will be accessible inside the $_POST superglobal assuming you have a post query. You can assign them to new vars or just work with the array vars. ie:

<input type="text" name="name">

$name = $_POST['name'];
echo $name;

or simply:
echo $_POST['name'];

You say it doesn`t work. Thats not really helping us too much. Can you give us some indications of the errors you are seeing?

dc