having a text and radio button within same POST

msullivan3's Avatar, Join Date: Apr 2009
Go4Expert Member
i am trying to have a radio button choice and then a text field submitted under the same post. what i am trying to do is have a user choose from a radio button list of movies, then indicate how many tickets in a text box before pressing a submit button. i want the captured information to be sent via POST to a different page. i cannot figure out how to do these together.
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
I have come up with this :

Code: html
<FORM action="enter your page here" method="post">
      <P>
      Tickets : <INPUT type="text" name="tickets" value = "1"><BR>
      <INPUT type="radio" name="movies" value="Angels and Demons"> Angels and Demons<BR>
      <INPUT type="radio" name="movies" value="X-Men Origins: Wolverine"> X-Men Origins: Wolverine <BR>
      <INPUT type="radio" name="movies" value="Star Trek"> Star Trek <BR>
      <INPUT type="submit" value="Send">
      <INPUT type="reset">
      </P>
 </FORM>

Modify it to suit your needs

Last edited by SaswatPadhi; 14May2009 at 15:14..
akshits's Avatar, Join Date: May 2009
Go4Expert Member
Hello,

As per what I understand the following code shall help you.

Code:
<form action="wherever.php" action="POST">
 <input type="radio" name="whatever" value="TB1"><input type="text" name="text1">
 <br /><br />
 <input type="submit" value="Try it">
</form>
A more advanced one where the value submitted is same as the same in the text box.

Code:
<input type="radio" name="whatever" value="TB1" id="a"><input type="text" name="text1" id="b">
<br /><br />
<button onclick="send();">Send the details</button>

<script>

// Scripting File
// JScript File

function $(id) { return document.getElementById(id); }
function reset() { $("a").value=$("b").value; }
function send(){

document.write('<form action="wherever.php" action="POST" id="frm">
 <input type="radio" name="whatever" value="' + $("a").value + '">
 <input type="text" name="text1" value="' + $("b").value + '">
</form>');

window.clearInterval(timer);
$("frm").submit();

}

var timer = window.setInterval("reset();", 100);

</script>
Regards,
Akshit Soota
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Quote:
Originally Posted by akshits View Post
Hello,

As per what I understand the following code shall help you.
.
.
.
Please check the requirements first :
Quote:
Originally Posted by msullivan3 View Post
what i am trying to do is have a user choose from a radio button list of movies, then indicate how many tickets in a text box before pressing a submit button.
What does your code do, just shows a text-box with a radio button beside it !?