Jump to content

Archived

This topic is now archived and is closed to further replies.

Accurax

Radio Button Problem

Recommended Posts

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)

[code]<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[/code]

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;

[code]$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.";
[/code]


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\" /] ):

[code]$msg = "<font face=\"arial\" size=\"2\"><b>$your_sex:</b> $_POST[male]\n<br>";[/code]
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

Share this post


Link to post
Share on other sites
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??

Share this post


Link to post
Share on other sites
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 [b]BASIC[/b] 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\" /]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[!--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) [snapback]372977[/snapback][/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\" /]

Share this post


Link to post
Share on other sites
[!--quoteo(post=372978:date=May 10 2006, 12:08 PM:name=Accurax)--][div class=\'quotetop\']QUOTE(Accurax @ May 10 2006, 12:08 PM) [snapback]372978[/snapback][/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\" /]

Share this post


Link to post
Share on other sites

×

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.