Page 1 of 1

form processing question

Posted: Wed Jul 07, 2004 11:34 pm
by C_Calav
hi guys, i got a question.

i got a submit page for users details and i can post that to the next page that has all the users mistakes on it - proccess.php - for example "you havent filled blank out correctly go back and fill out again" now my question is how would i go about going back to the submit form with the details STILL in there?

any help what so ever would be great! is this the best way to do it?

thanx

Posted: Wed Jul 07, 2004 11:39 pm
by ol4pr0
Why not keeping it on the same page

Code: Select all

#with $_SERVER['PHP_SELF']
#example 
if(isset($_POST['submit']))
{		
	if(strlen($_POST['some'])>0)
	{
	$some ='1';
	}
	else
	{
	$some = '* You forgot Something';
	}

#than youre form would look like this

if($some == '1')
{
echo '<font size="2">Some<input type="text" name="'.$_POST['some'].'">';
}
else{ echo '<font size="2">Some<input type="text" name="some">'.$some.'';
}

Posted: Wed Jul 07, 2004 11:45 pm
by C_Calav
i dont have too much room to play around with on that page. i did have it like that in the first place.

can i go back a page and still keep the users data in the submit form?

Posted: Thu Jul 08, 2004 6:52 am
by kettle_drum
You can as long as you echo it back as the forms values of keep it in hidden fields. I always post my forms, check that everything is ok and if it isnt show an error message that has all the data hidden in a form on that error page. Then the user clicks a button to go back to the first form where the data they entered to begin with is placed into the form as the default field values.

Once you code this up into OO its very simple, and you dotn have to keep typing out the hidden forms and stuff.

Posted: Thu Jul 08, 2004 9:33 pm
by tim
try adding this to the top of the page.

header("Cache-control: private");

Posted: Fri Jul 09, 2004 1:13 am
by ol4pr0
I am wondering about youre methods kettle_drum can you post / send me a example ?