1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

having a text and radio button within same POST

Discussion in 'Web Design, HTML And CSS' started by msullivan3, Apr 28, 2009.

  1. msullivan3

    msullivan3 New Member

    Joined:
    Apr 27, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    I have come up with this :

    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:
     
    Last edited: May 14, 2009
    shabbir likes this.
  3. akshits

    akshits New Member

    Joined:
    May 10, 2009
    Messages:
    23
    Likes Received:
    2
    Trophy Points:
    0
    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
     
  4. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    Please check the requirements first :
    What does your code do, just shows a text-box with a radio button beside it !?
     

Share This Page