Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2003-03-25, 04:55 PM
Anonymous
Guest
 
Posts: n/a
Default

I have a form that has the details put into a database, but I need to show the information on the screen first so the person can say 'validate it'.
how do i show the information from the form, and how do i then pass the information to the page that adds the detail to the database?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2003-03-25, 10:13 PM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

Well you need to do something like this:

Code:
<?

// you could create temp vars

$field1 = $_POST['field1'];

$field2 = $_POST['fiels2'];

// ... and so on.



// show the form fields to the user

echo "<b>Field1:</b> $field1<br/>";

echo "<b>Field2:</b> $field<br/>";

?>

<form name="validate" method="post" action="dbscript.php">

<input type="hidden" name="field1" value="<?=$field1?>">

<input type="hidden" name="field2" value="<?=$field2?>">

<input type="submit" name="submit" value="continue">

</form>
As you can see you need to use hidden fields to store the values - then this will allow you to pass them to the next page.

hope this helps

Stuart
Reply With Quote
  #3 (permalink)  
Old 2003-04-30, 11:22 AM
Anonymous
Guest
 
Posts: n/a
Default

Well, excuse me for my English, as well as for the intervention.
If you use some JavaScript in your pages, you can also avoid posting twice, by replacing the submit button with another button and a JS function that does what you need before posting, open a popup with the information of your form, if OK, you call form.submit, otherwise you get back to the form (nothing to do, or maybe a focus on the right place).
I hope it will help, even if I don't give technical details.
A++
Reply With Quote
  #4 (permalink)  
Old 2003-05-09, 11:15 AM
Junior Member
 
Join Date: May 2003
Posts: 3
ctiberg
Default

This would force you to use 'human-friendly' names in your POST form, but anyways:

for ($_POST as $key => $val)
print $key.": ".$val."
";
__________________
Have a nice day,
Christian Tiberg
Reply With Quote
  #5 (permalink)  
Old 2003-05-09, 10:49 PM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

that is a good simple way to see all passed form fields. but shouldn't it be:
PHP Code:
foreach(&#036;_POST as $key => $val) {
 
echo &#036;key." -> ".$val."
";

Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:49 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.