Hi,
I have used a loop so there are a number of quantity drop down menu's designed for a shopping cart style website, with $i being the loop counter and qty being the name of the drop down menu so I have used (ignore the onChange function) - <select id='qty{$i}' onChange='findTotal($price,$i)'>
-
<option value='0'>0</option>
-
<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>
-
<option value='6'>6</option>
-
</select>
What I need to know is how to get the value of the selected option when a link is clicked, my link is currently - <a href="index.php?quantity=$qty{$i}>Add to Cart</a>
however I know this does not work, when I check the link on the live page it's linking to http://blablabla.com/index.php?quantity=0 http://blablabla.com/index.php?quantity=1 http://blablabla.com/index.php?quantity=2
and so on for each link...
Can anyone help me find a way to have the value of the quantity in place of the number of the loop?
Thanks in advance!
2 4136
Hi,
I have used a loop so there are a number of quantity drop down menu's designed for a shopping cart style website, with $i being the loop counter and qty being the name of the drop down menu so I have used (ignore the onChange function) - <select id='qty{$i}' onChange='findTotal($price,$i)'>
-
<option value='0'>0</option>
-
<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>
-
<option value='6'>6</option>
-
</select>
What I need to know is how to get the value of the selected option when a link is clicked, my link is currently - <a href="index.php?quantity=$qty{$i}>Add to Cart</a>
however I know this does not work, when I check the link on the live page it's linking to http://blablabla.com/index.php?quantity=0 http://blablabla.com/index.php?quantity=1 http://blablabla.com/index.php?quantity=2
and so on for each link...
Can anyone help me find a way to have the value of the quantity in place of the number of the loop?
Thanks in advance!
I'm assuming that you want the following behaviour? User clicks on link to a paage which contains the select list. Depending on the value of quantity in the query string, the page is to load with that value in the select list pre-selected?
Try something like this:
[PHP]
$opts = array(0,1,2,3,4 ,5,6);
print "<select id=\"qty$i\" onChange=\"find Total($price,$i )\">";
for ( $j = 0, $j < count($opts); $j++ )
{
print "<option value=\"".$opts[$j]."\"";
print ($quantity == $opts[$j] ? " selected " : "");
print ">$opts[$j]</option>";
}
print "</select>"
[/PHP]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: KK |
last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . .
1. Alot of people put them in the
they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up
category (a la "frames"). Do you think this is true>
2. Some people think they take up too much KB.
3. Some people are worried that people who have javascript turned off
wont be able to see them. What percent of web users have javascrips
turned off? I thought it was...
|
by: Haines Brown |
last post by:
I've implemented the horizontal drop down menu discussed recently in
this newsgroup, and it works nicely under Galeon and Mozilla, but
not IE 5.0.
Here are the problems:
Under IE 5.0, the there is no drop down menu functionality at all.
I wanted to implement an alternative stylesheet for IE, but my
link to it is apparently broken. What is wrong with my link? I'd
|
by: vikram.cvk |
last post by:
Hello Experts,
Im trying to design a CSS vertical drop down menu which should have the
following functionality.
Home
About Us
|
-->Overview
|
by: hemanth.singamsetty |
last post by:
Hello there,
I've a drop down menu (created using CSS & Javascript -- see code
below).
My problem is, whenever I click a link on the menu
the new page replaces the current page (and the menu
disappears). Is there a way, I can keep the menu always
on top. ( A good example of what I'm looking for is similar
to the menu bar in http://www.milonic.com/ ).
|
by: simon.cigoj |
last post by:
I have an javascript made menu and some forms with the dropdown
element. When the menu opens and scrolls down the drop down is
displeyed over the menu and obscures the menu choices. I have this
problem only in IE, in firefox it works ok.
Is there a solution to this problem? I tried to hide the drop down when
the menu opens but sometimes the menu covers only a small part of the
drop down, but enough to obscure the menu choice.
I would...
| |
by: Parz |
last post by:
Hi am facing problem in retrieving the value selected from drop down menu in one page from the next page..Am using the following code to populate the drop down menu with values form the database.
<td width="169" >
<select id="states" name="states" style="display:" >
<%
while not rsstate.eof %>
<option value="<%=rsstate("state")%>"><%=rsstate("state")%></option>
<%rsstate.MoveNext
wend
rsstate.Close
|
by: TycoonUK |
last post by:
Hi,
As I do not have IE7 on my computer, I was wondering if there is a
fault in my CSS Menu when using IE7.
Please can someone look at my site - http://www.worldofmonopoly.co.uk
and tell me if it works, and if it does not, tell me why it does not
work.
Thanks.
|
by: azeemqaiser |
last post by:
Hi All,
I have a form with two drop down controls. I want to change the values of Drop Down Menu 2 if i select some value in Drop Down Menu 1.
Like If i select country then all the states of this country should get populated in the second menu.
Will appreciate your help.
|
by: SQLjunky |
last post by:
Hello,
Contrary to what my screen name indicates, i'm actually quite new to SQL.
Having said that, I'll get right into my problem.
I'm trying to query an mssql database to return to the value that the user inputs through a drop-down menu in the databases GUI front-end (bugzilla actually). For example, a product is selected in a drop-down menu, and, depending on the product chosen, a second drop-down menu becomes active, containing a list...
|
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,...
|
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,...
| |
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |