Jump to content

Form Auto-Populate


modigy

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
Link to comment
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
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.