stern Posted October 11, 2006 Share Posted October 11, 2006 I am new to php programing with little background in HTML. Most of my knowledge would be in launguages like C++, assembler and raw machine code.While I am getting better at php data manipulation and DB control (these all make sense) I for the life of me cant get the simple things to work (like radio buttons). What I want to do is make 4 buttons (can only pick one of the 4) and have the choice return a number (1-4). While I can get the buttons to show and work "visually wise) on the screen, for the life of me I cant get it to give me a value (or I at least cant find "where" I supposed to get it from).After reading a post on radio buttons on the forum I tried it, but the "create radio buttons with HTML" part has left me in the dark. Here is a code snippet from the part with the radio buttons, and hopefully someone can tell me which really stupid mistake im doing here lol switch($_post["Radiobutton"]) { case "1": $val="1"; break; case "2": $val="2"; Bbreak; case "3": $val="3"; break; case "4": $val="4"; break; default: $val="0"; echo " <div align='left'>"; echo " <table width='956' border='0'>"; echo " <tr>"; echo " #$id "; echo " $question<br><br>"; echo " </tr>"; echo " <td height='24'> </td>"; echo " <td><div align='center'></div></td>"; echo " <td><font color='#FFFF80'>A</font>"; echo " <input type='radio' name='chk' value='1'> $choice1<br>"; echo " </tr>"; echo " <tr>"; echo " <td> </td>"; echo " <td><div align='center'></div></td>"; echo " <td><div align='left'><font color='#FFFF80'>B</font>"; echo " <input type='radio' name='chk' value='2'> $choice2<br>"; echo " </tr>"; echo " <tr>"; echo " <td height='24'> </td>"; echo " <td><div align='center'></div></td>"; echo " <td><font color='#FFFF80'>A</font>"; echo " <input type='radio' name='chk' value='3'> $choice3<br>"; echo " </tr>"; echo " <tr>"; echo " <td> </td>"; echo " <td><div align='center'></div></td>"; echo " <td><div align='left'><font color='#FFFF80'>B</font>"; echo " <input type='radio' name='chk' value='4'> $choice4<br>"; echo " </tr>"; echo " </table>"; echo " </div>"; }Now im sure after looking at this some may laugh them selves silly, as there is probably a way to do it short and simple.Thank you all in advance for any help you can give a newbee :-)Paul Quote Link to comment Share on other sites More sharing options...
mATOK Posted October 11, 2006 Share Posted October 11, 2006 I think that you need these buttons to be a part of a form <form name="something" action="file-with-switch" methos="get"> // or method="post"-- radio buttons<input type="Submit" value="Submit"></form> Quote Link to comment Share on other sites More sharing options...
stern Posted October 11, 2006 Author Share Posted October 11, 2006 That did the trick :-) thanks you so much for the help. I must really applaud all the people here, as you are all making it a lot easier for newbee's like me to learn a lot faster :-)Thank you all :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.