Jump to content

[SOLVED] passing radio values from embedded email message to php processing script


Recommended Posts

Hi, I've got an email that gets sent out with an embedded form in it. On the form are text boxes and radio buttons. Both present information read from a database correctly. The email allows the recipient to modify any informations and hit the SUBMIT button to modify the information back in the database. If I modify something in one of the textboxes, it makes the correct change (the info in passed along fine). But all the radio buttons are passing as 'on' when, in fact, some are not 'on' or ''....driving me nuts trying to find the fault. The information is either stored as YES or NO in the db. Below is a sample from the form where $row[6] contains YES or NO. That's being read okay. If I click the NO button on the form in the email, unlike the textbox, it isn't passing that to the processing php script. All radios are sent as 'on' for some reason. Thanks...I appreciate any heads-up on this.

 

if($row[6]=="YES")

{

$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\" CHECKED>YES     ";

$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\">NO</td></tr>";

}

else

{

$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\">YES     ";

$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\" CHECKED>NO</td></tr>";

}

 

try adding a value

$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\" value=\"YES\" CHECKED>YES     ";
$emailmessage = $emailmessage . "<input type=\"radio\" name=\"newvalue\" value=\"NO\" >NO</td></tr>";

Thanks...I was playing around and did just that. When there was no value listed at all, the reads from the database were correct, but on submission from the email form, all radio buttons were given an 'on' value. When I then listed a value exactly as you did here, all radio buttons were given an 'off' value on submission. I can't figure or trace what's going on here.

Hey, in putting together what you asked for, I just realized my dumb mistake. I was improperly testing the passed variable for =='on' when in fact it was being passed =='YES' or 'NO'. I knew it was a dumb mistake somewhere, but collecting the code parts brought it out...so thanks!

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.