Jump to content

Form Error message - keep fields filled in?


tpsilver10

Recommended Posts

So I finally got my CAPTCHA to implement just nicely. What I'm wondering is...is there a way to produce an error message on the same page without wiping the fields that the user just filled in?

 

At the moment I have

 

if ($_SESSION['security_code'] != $_POST['security_code'] && !empty($_SESSION['security_code'])){
header("Location: /pacesetter/index.php?id=quotes&subid=downunder&error=1");
exit;

 

if($_GET['error'] == 1){
echo "<span class='wrongcode'>You entered an incorrect security Code...</span><br />";

 

If you want to see what I mean: www.pacesettertravel.com/pacesetter/index.php?id=quotes&subid=downunder

Link to comment
https://forums.phpfreaks.com/topic/50853-form-error-message-keep-fields-filled-in/
Share on other sites

Hmm...dunno where the hell I'm going wrong, but I can't seem to get either of them to work. Odd...

 

<?php
$oldvalu = '';
if(isset($_POST['name'])) {
	$oldvalu = $_POST['name'];
    	}
echo"<input name=\"name\" type=\"text\" value=\"$oldvalu\" class=\"formstyles\" />";
?>

 

<input type='text' name='email' class="formstyles" value='{$_POST['email']}' />

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.