Multi-page form that preloads
Hello
First sorry if there is to much code in this example.
I am new to working with multi page forms.
I have a search form that gets preloaded info from the database.
There are 3 scripts (a html page, a preload script and a process script).
There is a search button and a submit button.
The user can alter this information.
If the user alters the preloaded infomation and then does a search
I want the altered information to be displayed along with the search results.
Note: the same search page reloads with the search results.
1) Should I use the hidden input script to hold the altered information?
2) Where should I place the hidden input script, on the form or the preload
script?
Note:I tried putting the hidden input script in preload.php
so I can use an if to determine if their is hidden info to pass
or pass the info from the database. But I could could not get that to work
It would be great if you could please show your suggestion.
Hidden input
[php]
if($_POST['fname']) $fname = $_POST['fname'];
echo ("input type = 'hidden' name='fname' value ='" .$fname ."'>\n");
[/php]
Preload script
[php]
<?php
/** preload.php**/
$spec_q ="select fname, lname, service_date
from customer
where customer_num = $customer";
$result = mysqli_query ($mysqli, $spec_q);
while($row = mysqli_fetch_array($result))
{
list($fname, $lname, $service_date) = $row;
list($ser_year_c, $a_month_c, $c_day_c)= split("-",$service_date);
}
?>
[/php]
Html page
[php]
<?php
/** search_form.php **/
include("preload.php");//preload first and last name and service date
?>
echo "$lname, $first"; //patient last name and org_patient_id
<?php
$month_name = get_a_month_name($a_month_n);
$month_code = get_a_month_code($a_month_c);
for($n = 1; $n<= 13; $n++)
{
$month=$month_name[$n];
$mcode=$month_code[$n];
echo "$month \n";
}
?>
<?php
$day_name = get_c_day_name($c_day_n);
$day_code = get_c_day_code($c_day_c);
for ($n = 1; $n<= 32; $n++)
{
$day = $day_name[$n];
$dcode = $day_code[$n];
echo "$day \n";
}
?>
Search for:
assgar
Junior Poster in Training
89 posts since Oct 2006
Reputation Points: 24
Solved Threads: 0