Jump to content

Archived

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

modigy

Form Auto-Populate

Recommended Posts

Hi All...I could really use some help...

I have a php form that passes its variables on to another php form that load the information into a MySQL database. Once completed with this operation, the user is returned to the original form.

I would like to be able to insert data from the prior entry back into the form for multiple entries.

How can I do this??

Exp: Textfields entered by client ([b]Input.php[/b]) sent as variables (to [b]AddInputMySQL.php[/b]) to be added to DB. I would like some of these variables sent back to Input.php to be reused for continuing 'dataentry'.

Input.php ---> AddInputMySQL.php <connection to MySQL, variables entered into DB>
^
|
<--------------------------< <-(specific variables from AddInputMySQL.php returned to Input.php)

ANY and ALL help would be greatly appreciated!!

Thank you,

M

Share this post


Link to post
Share on other sites
just have the input functions at the top of the page and add

[code]
<input type="text" name="field_name" <? if (isset ($_POST['php_form'])) echo "value=\"".$_POST['field_name']."\""; ?> />
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=382253:date=Jun 10 2006, 06:14 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 10 2006, 06:14 PM) [snapback]382253[/snapback][/div][div class=\'quotemain\'][!--quotec--]
just have the input functions at the top of the page and add

[code]
<input type="text" name="field_name" <? if (isset ($_POST['php_form'])) echo "value=\"".$_POST['field_name']."\""; ?> />
[/code]
[/quote]


joquius,

Thanks for your quick reply. A couple of questions I have:

1. Which form do I need to put this in?
2. You have written 'php_form' - which form would this be?

Thanks for your help,


M

Share this post


Link to post
Share on other sites
Input.php
[code]
<?php
   session_start();
?>

<form method='post' action='AddInputMySQL.php'>
   blah: <input type='text' name='blah' value="<?= $_SESSION['blah'] ?>">
   <input type='submit' value ='submit'>
</form>
[/code]

AddInputMySQL.php
[code]
<?php
   session_start();

   $blah = $_POST['blah'];

   //update database script etc...

   $_SESSION['blah'] = $blah;
   header("Location: Input.php");
   exit();
?>
[/code]

Share this post


Link to post
Share on other sites

×

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.