473,804 Members | 3,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to show only entered fields ?

hi all,

I am getting lost in showing data entered in a form to a confirm page.
I have a form with as many list/menu as the categories existing in the
database. DONE

when user choose the items from the list/menus they are passed on to a
second page where he can check if all data are correct and then send
it. DONE

However on the confirm page the script returns also empty lines of text
for the missing fields. I would like to just have the fields entered by
the user one after each other and not as they were on the first form.
How can I get rid of the empty fields ? ( of course just removing the
<BR> tag is not a solution )

I post the code of both pages below ( only the part of interest )

TIA

Johnny
CONFIRM PAGE
<form name="form1" method="post" action="send.ph p">
<p>Please check the data u entered</p>
<p>
<input name="hiddenFie ld" type="hidden" value="<?php

foreach ($_POST['field'] as $name=>$value) {
echo nl2br("$value") ;
}

?>">

<?php

foreach ($_POST['field'] as $name=>$value) {
$split = split("\=", $value);
$pieces = explode("=", $value);
echo nl2br("$pieces[1]<BR>");
}

?>
</p>

<input name="Submit" type="submit" value="PROCEDI &gt;&gt;">
</p>
</form>
FORM PAGE

<form name="form1" method="post" action="confirm .php">

<?php

$cat=mysql_quer y("SELECT DISTINCT category FROM table ORDER BY
id", $db);
while ($category=mysq l_fetch_array($ cat)) {
$array_categoy[]=$category["category"];
}

foreach($array_ category as $key=>$val) {
$data_link=mysq l_query("SELECT * FROM table WHERE
category='$val' ",$db);
?>
<?php $label = str_replace ( "_"," ",$val) ; ?>
<p> <?php echo $label; ?></p>

<select name="field[<?php $val ?>]"id="<?php $val ?>">
<option > - - - - - - - - - - - - </option>
<?php
while ($link=mysql_fe tch_array($data _link)) {
$description_li nk= $link["product"];
$id_link = $link["id"];
$code_link = $link["code"];

print "<option value=\"$code_l ink = $description_li nk\">
$description_li nk </option>";

}
?>
</select>
<?php
}
?>

<input name="Submit" type="submit" value="GO ON &gt;&gt;">
</form>

Jul 17 '05 #1
4 1888
johnny wrote:
However on the confirm page the script returns also empty lines of text
for the missing fields. I would like to just have the fields entered by
the user one after each other and not as they were on the first form.
How can I get rid of the empty fields ? ( of course just removing the
<BR> tag is not a solution )

Before you echo out the form value check to see if it's empty. I think
comparing it to an empty string will do, but if it doesn't try comparing
to null.

if($FormVal != "") // Possibly need to use: != null instead.
{
echo $FormVal;
}
--
Scott Orsburn
scottso_no@spam _maclaunch.com

Kaomso | Information Technology
www.kaomso.com
Jul 17 '05 #2
.oO(Scott Orsburn)
Before you echo out the form value check to see if it's empty. I think
comparing it to an empty string will do, but if it doesn't try comparing
to null.


empty() exists.

Micha
Jul 17 '05 #3
if (!strlen($formV al))

Jul 17 '05 #4
Michael Fesser wrote:
.oO(Scott Orsburn)
Before you echo out the form value check to see if it's empty. I think
comparing it to an empty string will do, but if it doesn't try comparing
to null.


empty() exists.

Cool. I was unaware of that one.
--
Scott Orsburn
scottso_no@spam _maclaunch.com

Kaomso | Information Technology
www.kaomso.com

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1415
by: MJ | last post by:
I have 4 pricing levels for products. Each customer has only 1 level. If a customer is pricing level 1, I don't want pricing levels 2-4 to show up on the query for each product. How can I accomplish this? Thanks in advance for your help!
6
2562
by: Vern | last post by:
I'm adding twenty nodes (Parent and child) to a tree view. Only 10 items are viewable in the window at at time. So when it initially shows the tree, it shows the last ten items forcing me to use the scroll bar to show the first 10 items. How do I change it to initially show the 1st ten items. I'm using a datareader to populate the treeview.
1
2546
by: Galka | last post by:
Hello I have a form to enter names and some other personal information. When a name is entered, it is checked against existing records: maybe, such name was entered before? If yes, user is notified and asked, would you like to see the previous record? If user answers yes, form on the screen is scrolled to the record with the same name. All works well, apart from number of record between navigation buttons: it is still the same number of...
1
1498
by: jmarr02s | last post by:
I created a subform with 4 separate fields (textboxes) each containing an 8 digit date I want the most current date to show in each of the four fields So under properties for the subform under Order By I entered the following: SATermDate DESC, CMSTermDate DESC, SATermDateRescinded DESC,
1
2148
by: sjvandevoorde | last post by:
I need some help with a couple forms/test fields. Bare with me I have been out of the field for some time and only consider myself an intermediate user. The first one is a subfrom which lists records including Decrease and Increase field. I have two text fields which are suppose to total each of these fields. This subform is within another form which should be displaying the current balance. The subform text feilds are: Decrease - (I...
9
9717
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
5
1564
theaybaras
by: theaybaras | last post by:
Hi, I'm still getting a feel for some things in Access. What I have is a database of scientific articles. I have an unbound memo field in which I want to have the APA style citation concatenated from other fields. I have 12 fields for author names. lets say author1, author2, author3, ... author11, author12. I need a different text in the citation if 7 or more authors are entered into the above fields. If 1-6 authors are listed citation...
2
2307
by: Sanjaylml | last post by:
I have made a form in Access 2000. In addition to just simply enter the data through form, I have appended sub-form in main form to show the all the entered records as Sub-Form (DataSheet), which is perfectly working. My problem is that now I want to show the sub-form based on my selection in Combo box field. Is it Possible to show the sub-form based on selection & if so, with Serial Number / Line Number of selected values in Sub-form...
482
28031
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my parts fields correctly. Currently this is what it does serial information 1 parts 1
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.