Help with a PHP Email Form...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jpmaki
Forum Newbie
Posts: 4
Joined: Tue Jan 11, 2005 9:37 am

Help with a PHP Email Form...

Post by jpmaki »

Need help making radio buttons post to my email form... Can anyone help???
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post some code?
jpmaki
Forum Newbie
Posts: 4
Joined: Tue Jan 11, 2005 9:37 am

Here is the code...

Post by jpmaki »

removed by moderator
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
jpmaki
Forum Newbie
Posts: 4
Joined: Tue Jan 11, 2005 9:37 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
jpmaki
Forum Newbie
Posts: 4
Joined: Tue Jan 11, 2005 9:37 am

Post 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";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply