S
Styck
Guest
Hey guys. I'm trying to setup a poll form for a website I'm creating. However, my activity between the html code for the form and the php script doesn't seem to correctly send the data. Also, when the 'Submit' button is pressed, my browser displays the PHP document and its code instead of actually running the code (or so I believe). I'm not very used to PHP and could really use some help:
**This is the form in HTML code**:
<table cellspacing="0" cellpadding="6" border="0" bordercolor="#0EF906" bgcolor="#0EF906" width="87%">
<tr>
<td align="left"><center><b>How did you hear<br>about Life Awareness?</b></center>
<form name="bsh6297" action="poll.php" method="POST">
<p><input name="LAR" class="Form" type="radio" value="Friend">Friend</input>
<br><input name="LAR" class="Form" type="radio" value="Youth Group">Youth Group</input>
<br><input name="LAR" class="Form" type="radio" value="Parents">Parents</input>
<br><input name="LAR" class="Form" type="radio" value="Flyer">A Flyer/Bulletin</input>
<br><input name="LAR" class="Form" type="radio" value="Church">During Mass</input>
<br><input name="LAR" class="Form" type="radio" value="Other">Other: </input><input name="LAR" class="Form" type="text" size="8" maxlength="26"></input>
<p><center><input name="Submit" class="Form" type="submit" value="Submit"></input></center></form>
</td>
</tr>
</table>
**and this is the PHP code in my 'poll.php' document**:
<?php
if ($_POST['Submit'] == "Submit")
{
$varLAR = $_POST['LAR'];
$errorMessage = "";
}
if ($errorMessage != "")
{
echo("<p>There was an error. Please resubmit your choice. \n");
}
else
{
$fs = fopen("pollData.txt" , "a");
fwrite($fs, $varLAR . "\n");
fclose($fs);
exit;
}
?>
Sorry. My browser is Safari 4.0.4.
**This is the form in HTML code**:
<table cellspacing="0" cellpadding="6" border="0" bordercolor="#0EF906" bgcolor="#0EF906" width="87%">
<tr>
<td align="left"><center><b>How did you hear<br>about Life Awareness?</b></center>
<form name="bsh6297" action="poll.php" method="POST">
<p><input name="LAR" class="Form" type="radio" value="Friend">Friend</input>
<br><input name="LAR" class="Form" type="radio" value="Youth Group">Youth Group</input>
<br><input name="LAR" class="Form" type="radio" value="Parents">Parents</input>
<br><input name="LAR" class="Form" type="radio" value="Flyer">A Flyer/Bulletin</input>
<br><input name="LAR" class="Form" type="radio" value="Church">During Mass</input>
<br><input name="LAR" class="Form" type="radio" value="Other">Other: </input><input name="LAR" class="Form" type="text" size="8" maxlength="26"></input>
<p><center><input name="Submit" class="Form" type="submit" value="Submit"></input></center></form>
</td>
</tr>
</table>
**and this is the PHP code in my 'poll.php' document**:
<?php
if ($_POST['Submit'] == "Submit")
{
$varLAR = $_POST['LAR'];
$errorMessage = "";
}
if ($errorMessage != "")
{
echo("<p>There was an error. Please resubmit your choice. \n");
}
else
{
$fs = fopen("pollData.txt" , "a");
fwrite($fs, $varLAR . "\n");
fclose($fs);
exit;
}
?>
Sorry. My browser is Safari 4.0.4.