473,947 Members | 9,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to handle a second array ?

hi all,

I have an old script which has a dynamically populated form where the
user chooses the items from as many list/menu as the categories
existing in the database and then on a confirm page only the items
selected are shown to be checked by the user before sending them ( to a
third script )

Now I would like to add another list/menu field in the form to let the
user choosing the quantity of each item selected, but I don't know how
to handle it in the confirm page . I use a "foreach" to display the
array of items in the next page
, but how can I show the quantity for each item too ?

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

TIA

Johnny
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>

// THE PART I WOULD LIKE TO ADD

<select name="quantity" id="quantity">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>

// END OF NEW PART
<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 >>">
</form>
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) {

// HOW TO ADD THE QUANTITY TOO ?

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="SEND >>">
</p>
</form>

Jul 17 '05 #1
0 1309

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

Similar topics

9
17629
by: lawrence | last post by:
Is there an easy way to sort a 2 dimensional array alphabetically by the second field in each row? Also, when I use sort() on a two dimensional array, it seems to work a lot like array_reverse(). Can anyone tell me why?
4
2559
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I want all of the spaces to be put in the first slots of the array. IE 6 does this. But Firefox 0.9.1 doesn't, and I don't know why. I have not been able to reproduce it in very simple form (which is itself a puzzle). But example code is...
3
12279
by: src_mag | last post by:
Hello, I'd like to write JavaScript code that refreshes a frame once a second loading a different image each time. Basically, here's what the script would do: 0 sec load img0.gif 1 sec load img1.gif 2 sec load img2.gif 3 sec load img0.gif (back to the first image) 4 sec load img1.gif
21
13509
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of getting second highest value in an integer array. One method I know of is to make the 1st pass through the array and find the highest number. In the second pass we can find the highest number which is less than the number we obtained in the 1st pass.
3
10074
by: Logan McKinley | last post by:
I need to draw a dot where ever the user clicks (which will be on either the form or a couple dynamically placed picture boxes). I thought the following code should work: //--- static public extern IntPtr WindowFromPoint(System.Drawing.Point Point); //... h = (System.Drawing.Point)hits; // this is an array of Point objects ip = WindowFromPoint(h);
1
2843
by: RJN | last post by:
Hi In the mainscreen I have a datagrid and from here I open new windows on click of link button. And I'm doing it through RegisterStartupScript Me.RegisterStartupScript("PopUp", _ "<script language='JavaScript'> " & _ "var winOp = window.open('MyScreen.aspx', 'test');" + _ "if (winOp != null) winOp.focus();" + _ "</script>")
10
9100
by: Dancefire | last post by:
Hi, everyone, I'm writing a program using wstring(wchar_t) as internal string. The problem is raised when I convert the multibyte char set string with different encoding to wstring(which is Unicode, UCS-2LE(BMP) in Win32, and UCS4 in Linux?). I have 2 ways to do the job:
4
4599
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
2
2059
bilibytes
by: bilibytes | last post by:
Hi, I have a database with a one to many relationship and i was wondering what was the best way to parse the resultset. this post explains exactly what my situation: http://stackoverflow.com/questions/541472/php-and-outputting-one-to-many-results I don't have PDO neither MySQLi So if you go to the post, you'll see that there are 2 solutions.
0
9982
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11160
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11347
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
9888
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...
1
8255
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7430
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4538
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3543
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.