Solved

Need to create a dynamically populated dropdown box for selling shoes

Posted on 2006-06-22
5
193 Views
Last Modified: 2010-04-27
Okay here is what I need.  I'm starting a website selling shoes and on the 'Buy' page, I need a dynamically populated dropdown box.  Let's say I have 10 pairs of size 11, well I need the dropdown box to be smart enough to know that when 10 people purchase size 11, I have run out of size 11 and this option no longer appears in the dropdown box.  Also, I need to be able to link the size the person picks in the dropdown box to the paypal website so that when the person checks out, it specifies what shoe size/type of shoe they have selected.  Thanks.
0
Comment
Question by:AirCarter15bh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 21

Expert Comment

by:Julian Matz
ID: 16963760
I can give you some guidance for php/mysql...

<?php
$connection = mysql_connect('localhost','username','password') or die ( mysql_error() );
mysql_select_db('name_of_database');

$query = "SELECT * FROM table_shoes ORDER BY size";
$result = mysql_query($query,$connection);
?>

<select name="shoes">
<?php
while ( $row = mysql_fetch_assoc($result) ) {
 echo "<option value='{$row['id']}'>{$row['name']} - {$row['color']} - {$row['size']}</option>\n";
}
mysql_free_result($result);
mysql_close($connection);
?>
</select>


When the form is then submitted, you will receive the ID number, so all you have to do is run a database query on that to get the rest of the data to populate input fields for PayPal or whatever....

Hope this helps...
0
 

Author Comment

by:AirCarter15bh
ID: 16965042
I don't really understand what you have given me.  Is this code that I can input into the head of my html? Give me a little guidance here on what this is and how I use it and what it will do for me.  Remember, I'm a newb at this stuff.  Talk to me like I'm highly uneducated about the subject...because I am, thanks.
0
 
LVL 21

Accepted Solution

by:
Julian Matz earned 250 total points
ID: 16965144

No problem... The above is a server-side scripting language called PHP and it uses a database management system called MySQL. Both require the server on which your site is on to have the software installed on it. Both are open-source and free, so in most case you'd find the two installed on Linux servers.

The code can be placed anywhere on your HTML page, but must start and end with these two:
<?php
 //php code...
?>

and the server must know to parse the code, so you need to give it a .php extension (rather than .html or .htm).

The php connects to a MySQL database (I didn't know what kind of database technology you were using, but I'm thinking you will need some sort of a database to be able to do what you're trying to achieve).

There are many step-by-step php/mysql tutorials on the web... Just type "php mysql tutorial" in Google.
Another great resource os the PHP manual - www.php.net.

PHP and MySQL might not be available to you, in which case I don't think I can be of much help to you...
If you don't know if php is installed you can run a quick test...

Open a page for editing and add the following lines of code:

<?php
echo "This is a test...\n";
// You should not be ale to read this line...
?>

Then save it as "test.php" and upload it to your server.
Open the page in your browser by entering the URL to it:
http ://www .example.com/test.php

If you can only see the text "This is a test..." then php is installed and working...
You should not be able to see the rest of the code or the text which reads "You should not be ale to read this line...".
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question