Jump to content

Sve POST data


karimali831

Recommended Posts

Hi,

 

When a user makes a mistake and they go back to the form, all fields are cleared.

How can I make it so that when they go back to the form, the data is still inputted?

 

Here is what I got:

 

     if($_POST['name']=="") $error_array[] = 'You must enter a title';
     if($_POST['info']=="") $error_array[] = 'You must describe the bug';
     if($_POST['filename']=="" || $_POST['filename']==".php") $error_array[] = 'You must specify the filename. e.g. cups.php';
     if($_POST['errorlocation']=="" || $_POST['errorlocation']=="http://") $error_array[] = 'You must specify the location of this bug, if not, specify your website';
 if(count($error_array)) 
 {
	$error=implode('<br />&#8226; ', $error_array);
	$showerror = '<div class="errorbox">
	  <b>Please fix the following error(s):</b><br /><br />
	  &#8226; '.$error.'
	</div>';
	echo $showerror.'<br /><input type="button" class="button" onClick="javascript:history.back()" value="Go Back">';

      }else{ mysql_query() }

 

Any help is appreciated,

Thanks!

Link to comment
Share on other sites

You can achieve this a number of ways. If the content is not private then you could put the data into the URL. Or you could put the data in SESSION variable. When the check php goes back to the form page, the form page gets the data from where ever you put in it and inputs it into the form fields.

 

e.g. name field

$name = "";

if(isset($_GET['name']))
  {
    $name = $_GET['name'];
  }
echo "<input type=\"text\" name=\"name\" value=\"$name\"/>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.