?
Solved

Query DROPBOX

Posted on 2003-10-27
5
Medium Priority
?
449 Views
Last Modified: 2013-12-12
whats wrong in this code ...

<?php
$serveur_z = "localhost";
$login_z = "root";
$pass_z = "";
$base_z = "medical";

mysql_connect($server_z, $login_z, $pass_z) or die('Erreur de connexion');
mysql_select_db($base_z) or die('Base inexistante');
?>

<form action="analyses.php" method="post">

<select name="table" value="<? echo "$table"; ?>">
<option selected>Selection analyse</option>

<?php
$query = mysql_query("SELECT nom FROM analyses");
while ($myrow = mysql_fetch_row($query)) {
echo "\t<option value=\"$myrow[0]\" >$myrow[0] </option>";
}
?>

</select><input type="Submit" name="action" value="OK">
</form>

<?php
mysql_connect($server_z, $login_z, $pass_z) or die('Erreur de connexion');
mysql_select_db($base_z) or die('Base inexistante');

if ($action=="Ok"){
$query = mysql_query("SELECT * FROM analyses WHERE nom=$table");
$result = mysql_fetch_array($query);
echo $table["tube"];
}
?>



The first party is good ... i have a drop box --- but the second party does not work

It should display others info of the value selected in the drop - box

i need a sample
0
Comment
Question by:shingu
3 Comments
 
LVL 1

Accepted Solution

by:
rstorey2079 earned 100 total points
ID: 9629475
Do you know whether or not you have register_globals set to On or Off?

If register_globals is off, then you need to change this:

if ($action=="Ok"){
$query = mysql_query("SELECT * FROM analyses WHERE nom=$table");
$result = mysql_fetch_array($query);
echo $table["tube"];
}

to this:

if ($_POST['action']=="Ok"){
$query = mysql_query("SELECT * FROM analyses WHERE nom=$_POST['table']");
$result = mysql_fetch_array($query);
echo $table["tube"];
}
0
 

Author Comment

by:shingu
ID: 9630228
ok its helped but always no display of other fields information
0
 
LVL 13

Assisted Solution

by:lozloz
lozloz earned 100 total points
ID: 9630892
i think you mean to have echo $result["tube"]; instead of $table["tube"]; ?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

840 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