Results 1 to 2 of 2

Thread: prevent form fields from clearing after submit

  1. #1
    Join Date
    Apr 2013

    Question prevent form fields from clearing after submit

    i have form fields in ajax . after submitting i need the values remain constant

  2. #2
    Join Date
    May 2003
    Hold the form values in an array with blank values. Then if the page has been posted load those values into the placeholders in the array.

    PHP Code:
    $frm_vals = array(

    $frm_vals as $key=>$val){
    $frm_vals[$key] = $_POST[$key];

    Now you have form values for the inputs...if the page has been posted then the values will be filled, or else they will be blank...you inputs would look like

    PHP Code:
    echo "<input name=\"name\" value=\"".$frm_vals['name']."\">"
    if using ajax you could do the same thing by returning the array values as JSON instead of hard-coding the form with PHP.
    We do precision guesswork

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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