Form Validation Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve.burgess@boston-spa.org.uk

    #1

    Form Validation Query

    I have a form on my website
    (http://www.nprie.info/content.php?pn=12&frm=3~4). When the user
    submits the form various validation checks are completed by another PHP
    script. If any of these fail, the user is redirected back to the form.
    The content that they submitted is retained and sent back in the URL
    and picked up by another script and inserted into the fields.

    My problem is with memo fields as this method of returning the data
    seems to chop off anything after the first newline or carriage return.

    I presume it would be better to POST this information back but how do I
    do this from PHP without a SUBMIT button???

    Many thanks for your continued help.

    Hope all that makes sense - see the website which should clarify the
    process.

    p.s. the &frm=3~4 in the link simply ensures that my name appears in
    the
    "TO" box so if you test the script spurious messages don't go to my
    colleagues.

  • Ken Robinson

    #2
    Re: Form Validation Query


    steve.burgess@b oston-spa.org.uk wrote:[color=blue]
    > I have a form on my website
    > (http://www.nprie.info/content.php?pn=12&frm=3~4). When the user
    > submits the form various validation checks are completed by another[/color]
    PHP[color=blue]
    > script. If any of these fail, the user is redirected back to the[/color]
    form.[color=blue]
    > The content that they submitted is retained and sent back in the URL
    > and picked up by another script and inserted into the fields.
    >
    > My problem is with memo fields as this method of returning the data
    > seems to chop off anything after the first newline or carriage[/color]
    return.[color=blue]
    >
    > I presume it would be better to POST this information back but how do[/color]
    I[color=blue]
    > do this from PHP without a SUBMIT button???[/color]

    You probably want to use Sessions here. At the top of each file insert
    "session_start( )" as the first PHP statement.

    Instead of putting the information into the URL, create a SESSION
    variable for each variable you need to send back.

    $_SESSION['form_field'] = $_POST['form_field'];

    Then in the program that redisplays the form, use the value in the
    session variable.

    Ken

    Comment

    • Geoff Berrow

      #3
      Re: Form Validation Query

      I noticed that Message-ID:
      <1108047215.654 351.101250@z14g 2000cwz.googleg roups.com> from
      steve.burgess@b oston-spa.org.uk contained the following:
      [color=blue]
      >I have a form on my website
      >(http://www.nprie.info/content.php?pn=12&frm=3~4). When the user
      >submits the form various validation checks are completed by another PHP
      >script. If any of these fail, the user is redirected back to the form.
      >The content that they submitted is retained and sent back in the URL
      >and picked up by another script and inserted into the fields.
      >
      >My problem is with memo fields as this method of returning the data
      >seems to chop off anything after the first newline or carriage return.
      >
      >I presume it would be better to POST this information back but how do I
      >do this from PHP without a SUBMIT button???[/color]

      I'm not sure of the answer, mainly because I never do it this way. It's
      perfectly possible to do this with a single page, in which case the
      problem simply does not occur, since you have the post data to refill
      the fields.

      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Steve

        #4
        Re: Form Validation Query

        Thanks - but for various reasons I would prefer to keep the validation
        in a separate script (related to the way I've constructed the site -
        using a bespoke CMS).

        Comment

        Working...