Current location: Hot Scripts Forums » Programming Languages » PHP » Dropdown problem

Dropdown problem

 
Prev Previous Post   Next Post Next
  #1  
Old 08-04-04, 06:42 AM
Space_kadett Space_kadett is offline
New Member
 
Join Date: Aug 2004
Location: Oslo, Norway and St Thomas, USVI
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Dropdown problem

I'm making a dropdown list populated with all productnames from a pricelist (table), where users can select a product, and hit the button to proceed to a page that displays product details and price.
Works like a charm - except for ONE small problem: the first product in the table doesn't appear on the dropdown list, it starts out with a empty line.
If you select the empty line, you get a
-You have an error in your SQL syntax near '' at line 1- message on the next page, all the others work perfect....
I'm confused here - can anyone help??
PHP Code:
<?php
//connect
$db mysql_connect("host""user""password");

mysql_select_db("database"$db);
// We have now connected, unless you got an error message 

//get ID and item from table
$query_art "SELECT ID, art FROM prices";
$art mysql_query($query_art) or die(mysql_error());
$row_art mysql_fetch_row($art);
?>

<!--sends ID from selected item to display.php-->

<form name="form" method="post" action="display.php">
  
   <select name="fieldOne">
    <option value="">Velg artikkel</option>
    
<?php
//insert item into dropdown with ID as value
do 
    {  
?>

    <option value="<?php echo $row_art['ID']?>"><?php echo $row_art['art']?></option>
<?php
    

while (
$row_art mysql_fetch_assoc($art));
?>
  </select>
          
    <input type="submit" name="Submit" value="Finn prisen" >

</form>
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie found a solution to a date problem. mickey_kamer Perl 4 05-09-07 06:54 AM
Count problem kasic ASP.NET 1 10-20-04 01:23 AM
an unusual problem.... fabulosas10 PHP 0 07-16-04 03:03 AM
DHTML layer "behind" dropdown menus !?! paulwynd JavaScript 3 01-14-04 08:57 AM
Multiple dropdown plus link problem bastiaan JavaScript 0 11-17-03 05:22 PM


All times are GMT -5. The time now is 05:22 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)