1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

HTML Forms

Discussion in 'Programming & Webmastering' started by Wozzer, Jun 28, 2013.

  1. Wozzer

    Joined:
    Jun 30, 2008
    Messages:
    1,133 (0.48/day)
    Thanks Received:
    68
    Location:
    England
    Hi All,

    I've developed a breif website to monitor the whereabouts of our company laptops. Just have a quick question.

    I'm using an HTML form with the POST method to insert data into the database. Once submitted, the page is re-directed to a page which the user can print. (ie - something for them to sign).

    I'm trying to automatically populate some fields based on what they inserted on the previous page. (ie - laptop number, etc).

    Any ideas on how to do this? I thought it would be the GET method, but I can't seem to get it to work.

    More than happy to post my code if required.

    Cheers
     
  2. BiggieShady

    BiggieShady

    Joined:
    Feb 8, 2012
    Messages:
    1,023 (1.00/day)
    Thanks Received:
    351
    Location:
    Zagreb, Croatia
    When the form posts, after the script on the server side inserts to database, instead of doing simple redirect, script can generate your printable html page with content (including fields and their initial values) based on input posted by the form ... you can mix html markup with script code so you won't need to generate all of html

    edit: what you are trying, redirecting using GET with all parameters (laptop number etc.), should also work
     
    Last edited: Jun 28, 2013
  3. Mindweaver

    Mindweaver Moderato®™ Staff Member

    Joined:
    Apr 16, 2009
    Messages:
    5,362 (2.62/day)
    Thanks Received:
    2,946
    Location:
    Statesville, NC
    What are you using a Windows or linux based website? (php or asp)

    EDIT: If you don't know about it you can go to W3Schools and get a lot of good info. :toast:
     
    Crunching for Team TPU
  4. Wozzer

    Joined:
    Jun 30, 2008
    Messages:
    1,133 (0.48/day)
    Thanks Received:
    68
    Location:
    England
    Thanks for the responses. Using PHP.

    When you say script - Do you mean like a Javascript script?

    At the moment - The user enters details, submits to database and on the submit button being pressed - it directs the user to a new page (which has a template they can print out). The template includes fields like date, laptop ID, etc - which if possible, i'd like to be automatically filled from the previous inputs.

    (ie - Essentially what you said BiggieShady - Just unsure what script you mean).
     
    Last edited: Jun 28, 2013
  5. Wozzer

    Joined:
    Jun 30, 2008
    Messages:
    1,133 (0.48/day)
    Thanks Received:
    68
    Location:
    England
    Problem Solved. Thanks
     
  6. W1zzard

    W1zzard Administrator Staff Member

    Joined:
    May 14, 2004
    Messages:
    15,007 (3.90/day)
    Thanks Received:
    11,877
    You can either put the data into the PHP session ($_SESSION), or just pass them to the next page in the query string (index.php?foo=bar&baz=qux) which will then appear in $_GET

    unless it's sensitive data, i'd use the query string

    oh and just to make sure header('Location: index.php'); to redirect, don't use some strange meta redirect stuff

    edit: if you store the user's input in the database, then just redirect him to the "view database entry" page with the previously inserted database id in the query string
     
  7. BiggieShady

    BiggieShady

    Joined:
    Feb 8, 2012
    Messages:
    1,023 (1.00/day)
    Thanks Received:
    351
    Location:
    Zagreb, Croatia
    I meant PHP script (mixed html/php).
    I'm glad you worked it out :toast:
     
  8. Zygmunt New Member

    Joined:
    Jul 19, 2013
    Messages:
    8 (0.02/day)
    Thanks Received:
    1
    Programming Language

    Now a days Java is becoming most popular programming language in development field. PHP is going back and Java is coming on front and now in smart phones Java is first priority.
    Lifestyle
    Glenvale Supported Living
    182-184 Hursley Road Toowoomba QLD 4350 Australia
    Phone : +61 1300 765 051
    http://www.glenvalesupportedliving.com.au/
    Providing community aged care supported living housing in Toowoomba, the Glenvale Villas are the perfect option for your loved ones, if they need a little extra help with daily living.
     
    Last edited: Oct 22, 2013
  9. Aleksander

    Joined:
    Dec 2, 2009
    Messages:
    3,254 (1.79/day)
    Thanks Received:
    304
    Just a question which would somewhat interest me
    What are the prices of websites where you guys live?
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page