Jump to content

List box with dynamic data display on side


shruti

Recommended Posts

I want to have a list box with values  coming from a column of table "XYZ"

When someone clicks one value , on the side it shows the other fields of the table "XYZ"

 

 

Can someone show me to a simple example as to how should i go about doing this?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

It's a help forum. You're not paying us, we have nothing telling us to help you. Manners and courtesy are a huge motivation, for the reference.

Why should we write your code for you? We've told you where to look, and there's nothing stopping you looking there. We're not here to work for you, we're here to help you. Like you said, we help people 'stuck with something'. We offered you a rope, and you didn't grab it.

Link to comment
Share on other sites

I understand, I know where to look. But sometimes when you hand a snake (looks like a rope) to a baby (who does not know as much as you do) you need to explain when to play with a rope and when not to touch something like a snake.

 

Anyways................there are others who help with a small change in my code.

Good bye 

Link to comment
Share on other sites

Look man, you asked for help on a very common thing, which suggests you didn't bother to even search.  Then you flat out admit that you're trying to get someone to do it for you instead of search.  I asked you to post code and errors.  You posted some code yes, but you didn't tell us what's wrong.  We aren't psychic.  We don't know what your code is supposed to be doing in the context of the rest of your site, blahblahblah long story short, you need to help us in order for us to help you, and just posting something and saying "fix it" and acting like it's our "duty" to do it, is not our idea of you helping. 

 

At the end of the day, it's your problem, not ours, so getting an attitude about it only hurts you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.