Solved

Query DROPBOX

Posted on 2003-10-27
5
437 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
5 Comments
 
LVL 1

Accepted Solution

by:
rstorey2079 earned 25 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 25 total points
ID: 9630892
i think you mean to have echo $result["tube"]; instead of $table["tube"]; ?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now