NO book i read did sticky form correctly

Discussion in 'PHP' started by winterheat, Oct 13, 2007.

  1. #1
    the sticky form is that if validation didn't pass, re-display the form with the value in the text input again (and for other input field as well...)

    no book I read did it correctly so far. (just for the text input)

    to reduce the problem, how about write a PHP program that will submit to itself, so that

    typing in

    foo "bar" foo

    and click "Submit" and the form will re-display the form with

    foo "bar" foo

    already typed in, kind of like what Google will behave.

    the program should also work with foo 'bar' foo

    Of the few books I read, none of them has a correct solution. If you know which book has a correct solution to this, please point me to it.
     
    winterheat, Oct 13, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Are you actually asking for something? I'm somewhat confused by this.
     
    nico_swd, Oct 13, 2007 IP
  3. tandac

    tandac Active Member

    Messages:
    337
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I think he's how to create a "sticky" form. The idea being, if you fill in the form incorrectly it redisplays with appropriate error messages and the same values filled in.

    Since the poster seems to be looking to learn rather than a specific solution, I'll suggest looking at the $_POST variable and this example:
    <input type="text" name="name" value="<?php echo $_POST['name']; ?>" /> 
    Code (markup):
     
    tandac, Oct 13, 2007 IP
  4. winterheat

    winterheat Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i am asking why all the examples of "sticky form"

    if you type in

    foo "bar" foo

    in the box, it won't come back as

    foo "bar" foo
     
    winterheat, Oct 13, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    nico_swd, Oct 13, 2007 IP
  6. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #6
    If you post the code for a "sticky form" that doesnt "stick" that would be helpful for us to help you.

    Brew
     
    Brewster, Oct 14, 2007 IP