Jump to content


Photo

Radio Button Problem


  • Please log in to reply
5 replies to this topic

#1 Accurax

Accurax
  • Members
  • PipPipPip
  • Advanced Member
  • 246 posts

Posted 10 May 2006 - 12:17 PM

Hi there, i figure this is the best place for this...

First off... heres the URL that im working from so you can see what im doing : [a href=\"http://members.lycos.co.uk/cmbtest/\" target=\"_blank\"]MyTestSite[/a]

If your navigate to the "CV" section, and click on the Forms link.... you will find the form im constructing.

Now, all this form has to do is send the submitted data to me, and, it does this perfectly well ... for the text fields.

the radio buttons (and dropdown) do not send the information that is selected... the best ive managed is a named but empty field in the submitted mail.


I think i may be missing something quite fundemental, and i'm quite frustrated that the past 6 hours havnt manage to reveal the answer to me [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

Ok, heres some of my code, i'm going to show you the code that effects the "sex field" as its a decent example to work with ;

This part defines the radio buttons themselves (i figured this out myself, so there may be a better way)

<b>$your_sex:</b><br>\n
        <input type=\"radio\" name=$your_sex value=\"male\">Male
        <input type=\"radio\" name=$your_sex value=\"female\">Female <br><br>\n


basically Html... i'm not sure about the "name" parameter to be honest, and think this whole post may turn out to be one problem after another.... i apoligise in advance.


This next part is left over from when i had the "sex" field as a text input, but, now it's changed to radio buttons im not sure what, if anything i need to do with it;

$your_sex = "Your Sex";
$sex_empty = "You didn't fill in a sex, click 
<A HREF=\"javascript:history.go(-1)\">here</A> to go back.";


This next part processes the form (or it will one day [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] ):

$msg = "<font face=\"arial\" size=\"2\"><b>$your_sex:</b> $_POST[male]\n<br>";
mail($recipent);[/code]

Now, i have tried various things... including playing with if statement (im not very good at this) and ive had no success.... the best i manage to get is and e-mail title of "YOUR SEX = BLANK".

I'm pretty sure i know what i need to do..... i need to get the form to recognise the radio buttons, and identify the one that is selected. Then i need to get the script to process the information and send it in the correct format.

Problem is, i dont know how to do this,

I'm gonna carry on tryin to get this figured out.... but any help in any shape or form (Except Flames) is greatly appreciated.

I dont want you to do it for me.... i just need some help.

Thankyou

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 10 May 2006 - 02:12 PM

Your problem doesn't have anything to do with PHP. This is a strictly HTML coding issue.

The names of all your radio buttons have spaces in them and you don't have quotes around them. You shouldn't have spaces in the names of elements like radio buttons. And you should definately have quotes around that attribute.

And as far as the drop-downs, you don't have have a name for the select boxes, so how do you expect to refer to those values??

Info: PHP Manual


#3 Accurax

Accurax
  • Members
  • PipPipPip
  • Advanced Member
  • 246 posts

Posted 10 May 2006 - 04:40 PM

Thanks,

I've edited this post... as initiall i still couldnt get it to work.

But.......

[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Ive done it..... Thankyou so so so so much ,........ after thinking about what you said ..... somthing inside me just popped... and i realised the BASIC error i was making with the syntax of my html.

You were right.... and it makes sense also... i cannot pass a variable into itself... i think i was trying to do this.... thanks again.

Now.... time to look at those drop down menu's

I hope you dont mind if.... once ive spent some time trying to figure it out .... if i cant get it, ill post here again, i really appreciate it.... time for some vodka to celerbrate i feel [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 10 May 2006 - 04:58 PM

okay you have your quotes escaped \" on your other stuff but not on your name so i assume you need to do this:

name=\"sex\"

or else, you need to remove all of the backslashes in your form. it depends on how you are presenting your form in your code. please post your document in its entirety.

edit: nvm i posted same time as you
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 Accurax

Accurax
  • Members
  • PipPipPip
  • Advanced Member
  • 246 posts

Posted 10 May 2006 - 05:08 PM

[!--quoteo(post=372977:date=May 10 2006, 11:58 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 10 2006, 11:58 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
okay you have your quotes escaped \" on your other stuff but not on your name so i assume you need to do this:

name=\"sex\"

or else, you need to remove all of the backslashes in your form. it depends on how you are presenting your form in your code. please post your document in its entirety.

edit: nvm i posted same time as you
[/quote]

Thanks anyway ..... thats exactly what the problem was... <doh> .... and dont worry... id never post my code in its entirity.... i think it would take 15 odd pages up anyway... i'll only ever post code that relevant to the problem in hand.

but thanks for the heads up [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]


#6 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 10 May 2006 - 05:23 PM

[!--quoteo(post=372978:date=May 10 2006, 12:08 PM:name=Accurax)--][div class=\'quotetop\']QUOTE(Accurax @ May 10 2006, 12:08 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Thanks anyway ..... thats exactly what the problem was... <doh> .... and dont worry... id never post my code in its entirity.... i think it would take 15 odd pages up anyway... i'll only ever post code that relevant to the problem in hand.

but thanks for the heads up [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]
[/quote]
lol yeh i meant the relavent stuff and maybe even some code around it [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users