Hi Folks,

I want to maintain all the fields of the Form i.e when a form after posting return with some error then values in the other fields must be retained.

Kindly tell me few good methods to do this.

Thanks.:icon_wink:

Recommended Answers

All 3 Replies

Hi,
I guess server side you can set the values of the field.

Are you using Method="POST" to send the form via mail()? If so; you can put <?php echo $_POST; ?> in the <input value=""> section.

Member Avatar for soldierflup

Method 2 :

You can store the values of the $_POST or $_GET arrays (whatever method you use to post the form) in a session variable to use this values later on :

<?php
session_start();
$_session["varname"] = $_GET;
$_session["varname"] = $_POST;
?>

For later use you can then call the submitted values with the following code : <input name="field1" value="<?php echo $_session["varname"]["field1"]; ?> /> Hopes this is helpfull.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.