Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Populate forms with info from previous page

  1. #1
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334

    Populate forms with info from previous page

    Please help me.

    I am carrying out some work to a customer's website and trying to make it more user-friendly.

    Basically my client sells bouquets of flowers and when someone clicks that they would like to order a bouquet, she would like them to click a link that takes them through to the order form. However they would like the radio button for their required bouquet to be readily selected.

    I have tried to convert her to use a shopping cart, but she is unconvinced as her customers tend to order one bouquet at a time.

    Any help will be gratefully appreciated. Oh and happy thanksgiving to any of you on the other side of the pond (We only get harvest festival in September that only schools seem to celebrate)
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

  2. #2
    Member
    Join Date
    Sep 2005
    Posts
    82
    Not exactly sure how to read that.... do you need help in extracting the data from a form from a previous page or?
    Kim B. Juul
    Danish Web Design & SEO

  3. #3
    Senior Member
    Join Date
    Sep 2005
    Posts
    254
    Hi,

    If you're using some kind of server side scripting language you could simply pass the id of the required bouquet as part of the query string for the link (eg index.php?bid=1). Thats assuming each bouquet has a unique id. On the next page you can pick up this id and decide which radio button to select based on it.

    Mike

  4. #4
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334
    No the other way around: Clicking the order form link from a product page and the link/script somehow containing the information to populate the form (in this case, checking the appropriate radio button.

    So for example if you were looking at the 'lilies' page and you decide you want to buy some lilies, you click the 'order Lilies' button which takes you through to the order form with the 'Lilies bouquet' radio button checked, so all you have to do is fill in your details.

    There are a lot of programs online for extracting data from forms, but I am looking for the reverse.

    Does that make sense?

    Sorry. Thanx Mike your reply came through just as I was sending this. Do you have an example script to pick up the ID on form page?
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

  5. #5
    Senior Member
    Join Date
    Sep 2005
    Posts
    254
    What language would you be using? i know my way around php and asp, assuming the link index.asp?bid=1 in asp you can use

    Response.Write Request.QueryString("bid")

    In PHP it would be

    echo $_GET['bid'];

    Both will output the value of bid to the screen.

  6. #6
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334
    Thanx Mike

    I'd say I'd be using PHP.

    Would the script check the radio buttons?

    Forgive my naivety, but PHP is still quite new to me.
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

  7. #7
    Senior Member ADAM Web Design's Avatar
    Join Date
    Dec 2003
    Posts
    2,172
    I don't know the PHP way, Debbie. But in ASP, I can at least give you the concept that I use.

    Basically, I gather up all of the form data sent to me via post (no querystrings, since if you I hidden fields, the user can alter the data post facto).

    So here's how it works in ASP (the simple coding):
    Code:
    <%
    Dim Some_Field
    Some_Field = Request.Form ("Some_Field")
    
    ...
    %>
    <input type="text" name="Some_Field" value="<% = Some_Field %>" />
    The first time around, since there's nothing from your form post, ntohing will be assigned to the value.

    The second time around, whatever you put in the Some_Field field will appear in the field.

    Personally, I prefer to gather form elements to variables since that way, I can populate a form with either values retrieved from a database or form posts or even querystrings on rare occasions, depending on how I choose to set it up.

  8. #8
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334
    Is there a way to accomplish this using Javascript?

    On my travels into Cyberspace, I have come across

    http://www.webreference.com/programm...t/jf/column11/

    Which is almost the same thing but with the previous page instead of the pop-up window.

    Any help will br gratefully received.

    Thanx.
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

  9. #9
    Senior Member
    Join Date
    Aug 2004
    Posts
    219
    Here is how it would basically work in PHP:
    Code:
    <?php
    if (isset($_POST['flowers'])) {
    	$flower_type = $_POST['flowers'];
    	echo "Your customer wants to buy $flower_type";
    } else {
    	echo "
    <form name='flower_type' method='post' action='$PHP_SELF'>
      
    
    
        <label>
        <input type='radio' name='flowers' value='Lillies'>Lillies</label>
        
    
        <label>
        <input type='radio' name='flowers' value='Daffodils'>Daffodils</label>
        
    
      </p>
    </form>";
    }
    ?>
    That would be one way to handle your problem.

  10. #10
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334
    Thanks for your help WMJ :)

    If say the form was on a separate page to the order buttons, how would this be achieved?

    Sorry to be a pain.

    Many thanx & best regards
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

Page 1 of 2 12 LastLast

Similar Threads

  1. HELP! I need to remove a previous thread that is showing up in the SERPs Page 1
    By chirosche in forum Search Engine Optimization Forum
    Replies: 4
    Last Post: 04-24-2008, 12:45 PM
  2. Large info page or multiple smaller info pages
    By Milo in forum Search Engine Optimization Forum
    Replies: 4
    Last Post: 03-10-2008, 05:56 AM
  3. Large info page or multiple smaller info pages
    By Milo in forum Google Discussion Forum
    Replies: 4
    Last Post: 03-10-2008, 05:56 AM
  4. Multi-Page Forms
    By WiseWizards in forum Web Programming Discussion Forum
    Replies: 15
    Last Post: 06-28-2004, 08:59 PM
  5. Forms page
    By webhost1 in forum Graphics & Design Discussion Forum
    Replies: 10
    Last Post: 06-22-2004, 01:49 AM

Posting Permissions

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