Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   having a text and radio button within same POST (http://www.go4expert.com/forums/text-radio-button-post-t17182/)

msullivan3 28Apr2009 09:20

having a text and radio button within same POST
 
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 14May2009 15:11

Re: having a text and radio button within same POST
 
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 :smile:

akshits 14May2009 20:37

Re: having a text and radio button within same POST
 
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 14May2009 21:10

Re: having a text and radio button within same POST
 
Quote:

Originally Posted by akshits (Post 47824)
Hello,

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

Please check the requirements first :
Quote:

Originally Posted by msullivan3 (Post 46598)
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 !?


All times are GMT +5.5. The time now is 02:42.