473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multi-page form that preloads

41
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
?>

<html>
<form action="search_edprocess.php" method="post">

<table>
<tr>

<!---------------------customer name--------------------->
<td colspan="2" align="left"><font face = "arial" font size = "3px"><b>

<input type="text" name="first_name" size="15" maxlength="20" value ="<?php echo $lname; ?>"/>
<input type="text" name="last_name" size="15" maxlength="20" value ="<?php echo $fname; ?>"/>

echo "$lname, $first"; //patient last name and org_patient_id

</b></font></td>

<!-------------------date of service--------------------->
<td colspan="2">

<input type="text" name="service_yr" size="4" maxlength="5" value ="<?php echo $service_yr; ?>"/>

<!-------------------service date month dropdown---------------------->
<select name="service_month">
<?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 "<option value = '$mcode'";
if ($mcode == " ")
{
echo "selected";
}
echo ">$month \n";
}
?>
</select>

<!-------------------service date day dropdown---------------------->
<select name="service_day">
<?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 "<option value = '$dcode'";
if ($dcode == " ")
{
echo "selected";
}
echo ">$day \n";
}
?>
</select>
</td>
</tr>
<tr>
<td>
<!---------------------search box ------------------->
Search for:
<input type="text" name="find" />
</td>
<td ><input type="hidden" name="searching" value="yes" />
<input type="submit" name="f_button" value="Search" />
</td>
</tr>
</table>
</html>
[/php]


Process script
[php]
<?php

/**search_edprocess.php**/

$first_name = strip_tags(trim($_POST['first_name']));
$last_name = strip_tags(trim($_POST['last_name']));

//year of service
$service_yr = strip_tags(trim($_POST['service_yr']));
$service_yr = preg_replace("/[^a-zA-Z0-9\s,.]+/","",$service_yr);

$find = preg_replace("/[^a-zA-Z0-9\s,.]+/", " ", $find);

//month of service
$service_month = trim($_POST['service_month']);

//day of service
$service_day = trim($_POST['service_day']);

//year, month and day of service
$service_date = $service_yr."-".$service_month."-".$service_day;

/**** insert goes here****/
if(($_POST['f_button'])= "Submit")

/***find and submit bottons managed by switch**/
switch ($_POST['f_button'])
{

}

?>
[/php]
Dec 17 '06 #1
0 1928

Sign in to post your reply or Sign up for a free account.

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
17
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
2
by: Aussie Rules | last post by:
Hi, I have a site that Iwant to either display my text in english or french, based on the users prefernces ? I am new to webforms, but I know in winforms, this is pretty easy with a resource...
14
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
As far as I know, the C Standard has no mention of multi-threaded programming; it has no mention of how to achieve multi-threaded programming, nor does it mention whether the language or its...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.