Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-01-2008, 01:52 PM Dymanic Drop down...
Junior Talker

Posts: 2
Trades: 0
I have a listbox, and if you click on one value"say XXX" in it then it will display( select * from table where value='xxx')

I tired but i am getting an error
<span style="color: rgb(0, 0, 0);">

PHP Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<form id="form1" name="form1" method="get" action="<? echo $PHP_SELF?> ">
<?php  
 $host 
"localhost"
$user 
$pass =  
$dbname 
 
$connection mysql_connect("localhost""root""") or die("Cannot connect to MySQL server: " 

mysql_error());
$db_selected mysql_select_db(' ' $connection);
$query ="select CELLID from comments"
   
      
$result=mysql_query($query);


echo 
"<select name='CELLID'>\n";
while(
$row=mysql_fetch_assoc($result)){
  echo 
"<option value=\"$row[CELLID]\">$row[CELLID]</option>\n";
}
echo 
"</select>";  ?>
<input type="submit" name="Submit" value="Select" />
</form>
<hr>
<p>
<?

if (isset($_GET['submit'])){ 


$result=mysql_query("select problem, solution from comments where id='$select'");

while(
$row_list=mysql_fetch_assoc($result){
echo 
$row['problem'];


// End if statement.
}

// Close database connection.
mysql_close();
?>
</p>
</body>
</html>
It gets the cellids from the table but on submit it does not display the related data on the bottom of the page.

Please help
jadi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-01-2008, 08:13 PM Re: Dymanic Drop down...
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Well, at the bottom, you have:
PHP Code:
while($row_list=mysql_fetch_assoc($result){ 
but are trying to query the row with:
PHP Code:
echo $row['problem']; 
when you should be saying:
PHP Code:
echo $row_list['problem']; 
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Dymanic Drop down...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10134 seconds with 12 queries