Solved

Query DROPBOX

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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…
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…

822 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