Solved

Query DROPBOX

Posted on 2003-10-27
5
436 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 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

23 Experts available now in Live!

Get 1:1 Help Now