Form action problem

Discussion in 'HTML & Website Design' started by mfashraf, Nov 18, 2008.

  1. #1
    Hey. I need help. I'm having a problem with the form in my website. I don't really know how to make it go to diff pages w/ diff options.

    My website's on www.getyourquotes.com and the problem is on the main page itself. I want the form to forward to diff pages w/ different insurance type options. Thanks soo much in advance
     
    mfashraf, Nov 18, 2008 IP
  2. MikeHayes

    MikeHayes Peon

    Messages:
    95
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why use a form? Why not just have links and get the zip when they're there?

    Mike
     
    MikeHayes, Nov 18, 2008 IP
  3. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #3
    I don't really understand your question.

    Do you want to submit the form? You do that with:
    
    <form action="the_page_to_submit_to.php" method="post">
    <input type="text" name="something" /> <input type="submit" value="Submit" />
    </form>
    
    HTML:
     
    elias_sorensen, Nov 18, 2008 IP
  4. mfashraf

    mfashraf Active Member

    Messages:
    519
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    sorry. what i meant was that when ppl choose diff options, they go to different landing pages

    for example, when they click on auto, and key in the zip code, they go to results_auto.html. when they click on home, they go to results_home.html.

    so far, i only know how to go to only 1 certain page but not to diff pages.

    @ elias. your solution is the one that lets the people go to only one certain page. not to diff pages according to what their choices are
     
    mfashraf, Nov 19, 2008 IP
  5. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Try this, just made it quickly, but not tested., tested now. Works perfectly :)
    
    <script type="text/javascript">
    function changeFormLandingPage(pageValue){
    document.getElementById("submitForm").action = pageValue+'.php';
    }
    </script>
    <form action="standardpage.php" method="post" id="submitForm" />
    <select name="page" onchange="changeFormLandingPage(this.value)">
    <option value="standardpage">---- Select one ----</option>
    <option value="page1">This will land on page1.php</option>
    <option value="page2">This will land on page2.php</option>
    </select>
    <br />
    <input type="submit" value="Submit" />
    </form>
    
    HTML:
     
    elias_sorensen, Nov 19, 2008 IP
  6. mfashraf

    mfashraf Active Member

    Messages:
    519
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Thx a lot elias. Your solution works w/ a few minor changes here n there :D
     
    mfashraf, Nov 19, 2008 IP
  7. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #7
    You're welcome :)
     
    elias_sorensen, Nov 19, 2008 IP