i have a php form that adds info to a sql table to dynamically load on a website.
when they click submit it runs a PHP_SELF to reload the page and validates the form for blank boxes,etc...
how can i set it up so when it finds the error it keeps the current information in the text boxes rather than clearing them out
php form
Moderator: General Moderators
store the values of each form into a variable and then print the variable into value on the page:
Validation scriptDoes that make sense?
Validation script
Code: Select all
<?php
$title = some_type_of_filter($_POST['title']);
?>
<input type="text" name="title" value="<?php echo $title; ?>" />Well, if your page is reloading when there's an error, and you're not SUBMITTING any data for PROCESSING yet.. but just offering the form to the user again, something along the lines of this would be perfect:
Code: Select all
<input type="text" name="myTextField" size="20"<?php
if(!empty($_POST['myTextField'])){
echo ' value="'.htmlentities($_POST['myTextField'],ENT_QUOTES).'"';
}
?>>Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
-
eektech909
- Forum Commoner
- Posts: 34
- Joined: Fri Jun 09, 2006 3:59 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA