Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form field values passed through custom hyperlink

    This is probably total beginner question. Please bear with me.

    I have a form on the page in this format:

    Code:
    <form><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="2%">&nbsp;</td>
                <td width="31%"><img src="images/spacer.gif" width="1" height="20" alt="" /></td>
                <td width="67%">&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><span class="top_nav_link">Arrival Date:</span>
                  <input type="text" value="<?php echo date("m/d/Y") ?>" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" name="arr" class="calendarEntry" size="10" /></td>
                <td><span class="top_nav_link">Rooms:</span>
                  <select class="nightsEntry" name="rms">
                    <option value="1" selected="selected">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                  </select>              </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><img src="images/spacer.gif" width="1" height="17" alt="" /><span class="top_nav_link">Departure Date:</span><input type="text" value="<?php echo date("m/d/Y",strtotime("+24 hours")) ?>" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" name="dep" class="calendarEntry" size="10" /></td>
                <td><img src="images/spacer.gif" width="1" height="15" alt="" /><br /><input type="image" src="images/rates.gif" alt="Check rates" width="97" height="20" value="Submit" name="submitform" /></td>
              </tr>
            </table></form>
    When form is submited I need three values (arr,dep and rms) to be send in the link like this (example):

    http://domainname.com/search.availab.../15/2007&rms=3

    Form on the destination page accepts variables in this format. Typing link in the browser like that works.

    How would I do this? I tried many different paths and I had to scrap all of them. I tried setting the link as action for the form, tried posting form to itself and then pulling variables, I hit a wall each time.

    Please if anyone can point me in the right direction I would appreciate it.

    Thanks,
    Oz

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    I'm not quite sure what you're asking, but the only way you can pass form values is via a submit input on a form with the action and method values set appropriately (in your case, the name of your PHP processing script and "get" respectively).

  • #3
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    In case you still don't get it:

    Code:
    <form name="form1" action="nextpage.php" method="get">
    Substitute nextpage.php with the actual file you want to send the form data to.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •