Page 1 of 1
Help with a PHP Email Form...
Posted: Tue Jan 11, 2005 9:38 am
by jpmaki
Need help making radio buttons post to my email form... Can anyone help???
Posted: Tue Jan 11, 2005 9:41 am
by feyd
post some code?
Here is the code...
Posted: Tue Jan 11, 2005 9:43 am
by jpmaki
removed by moderator
Posted: Tue Jan 11, 2005 1:45 pm
by feyd
I said some, not all.

The parts that are necessary..
Or you could make an example of what you are trying to do.
Can you explain how the radio buttons are to be sent to this email form? Can you explain what your definition of "email form" is?
Posted: Tue Jan 11, 2005 1:52 pm
by jpmaki
K... i am not the developer of this form. is there any way we could take this off of here? i could explain better in an email and send you the code again.
there are a few radio buttons on this form. they are to indicate whether or not the user is a new member or involved in 8-ball or 9-ball (this is a pool league site). All i am looking for is how does that work... the way i have there now doesn't work properly and post it to an email.
Posted: Tue Jan 11, 2005 2:18 pm
by feyd
For the education of anyone else that may come along wonder about such things, I'd like to keep it here.
Okay, some code questions.. Can you post the form tag and radio button code used? If there's any Javascript involved with either, I'd like to see that code as well.
Posted: Tue Jan 11, 2005 2:37 pm
by jpmaki
Here is one:
in the top of my document:
$8ball = $_POST['8ball'];
$9ball = $_POST['9ball'];
Now for the corresponding radio buttons:
<tr>
<td width="43" valign="top" class="bodyCopy4">8-ball</td>
<td width="20"><input name="8ball" type="checkbox" id="8ball" value="<?php echo $_POST['8ball'];?>"></td>
<td width="36" valign="top" class="bodyCopy4">9-ball</td>
<td width="455"><input name="9ball" type="checkbox" id="9ball" value="<?php echo $_POST['9ball'];?>"></td>
</tr>
What goes to the email:
?
} else { /////// if no errors are found mail message
$_SESSION[date] = date("D F dS, Y g:ia");
$msg = "You have received an email from APA Registration.\n\n";
$msg .= "New Players:\t".$newplayers."\n";
$msg .= "8-Ball:\t".$8ball."\n";
$msg .= "9-Ball:\t".$9ball."\n";
Posted: Tue Jan 11, 2005 3:05 pm
by feyd
Last I checked $8Ball would be an illegal variable name. i.e. a variable must start with a letter or underscore.
You are setting the value of the 8ball/9ball checkboxes to the value posted to the page. Do you really want to do this? Or was it intended to automatically check the box?
If the latter, you'll need to check the value posted against the known "yes" type values and print "checked" into the tag's attributes, or not.. Note that if the posting page uses a checkbox for these, if not checked, the value will not be passed.