Jump to content


Photo

Form Auto-Populate


  • Please log in to reply
3 replies to this topic

#1 modigy

modigy
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts
  • LocationMadrid, Spain

Posted 10 June 2006 - 03:11 PM

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 (Input.php) sent as variables (to AddInputMySQL.php) 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
Code now, you'll get all the sleep you need when your Dead!!

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 10 June 2006 - 04:14 PM

just have the input functions at the top of the page and add

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

z..z..z..z..z..z..z..z..

#3 modigy

modigy
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts
  • LocationMadrid, Spain

Posted 12 June 2006 - 09:55 AM

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

<input type="text" name="field_name" <? if (isset ($_POST['php_form'])) echo "value=\"".$_POST['field_name']."\""; ?> />
[/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
Code now, you'll get all the sleep you need when your Dead!!

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 12 June 2006 - 02:47 PM

Input.php
<?php
   session_start();
?>

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

AddInputMySQL.php
<?php
   session_start();

   $blah = $_POST['blah'];

   //update database script etc... 

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

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users