Reply to Re: Keeping form elements in place after redirect

Your name:

Reply:


Posted by Beauregard T. Shagnasty on 11/21/07 20:36

Chris wrote (a question for a php group):

> I have a form that is processed by a php page and then redirected by
> the same php page back to the form page again.

...as you would do if there were errors or omissions in the filled-in
form.

> After the page has redirected back it clears the data entered in the
> form's textfield and combo selections. Is there a simple way of
> mainting the user's text/selections after the form has been
> redirected?

You have to send back the values and re-display them.

Example:
$contactname = $_POST['contactname'];
$email = $_POST['email'];

........

<div>
<p>Your name:</p>
<label><input type="text" name="contactname" size="30"
value="<?php echo "$strcontact";?>"></label>
</div>
<div>
<p>Your email address:</p>
<label><input type="text" name="email" size="30"
value="<?php echo "$stremail";?>"></label>
</div>

--
-bts
-Motorcycles defy gravity; cars just suck

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация