?
Solved

Query DROPBOX

Posted on 2003-10-27
5
Medium Priority
?
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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

770 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