Hi,
I am very new to php and mysql and want to write a little php app to display data from a DB.
with help I have managed to get a dropdown box working using the code below.
In the dropdown box I get a list of servers eg "merak"
I now want to use this varrible "merak" and run the following query and display it in the page, how do I make this happen.
The query was going to be: (straight from phpmyadmin)
$sql = 'SELECT `Name`, `Make`, `OS`, `Version` FROM `CES` WHERE `Name` = CONVERT(_utf8 \'merak\' USING latin1) COLLATE latin1_swedish_ci';
My current dropdown script:
<form class="table" action="check.php" method="post">
<div class="inner-form">
<div class="msg msg-info">
<p>Please select which server you wish to edit.</p>
</div>
<?
mysql_connect(localhost, root, admin);
@mysql_select_db(servers_db) or die( "Unable to select database");
echo "<select name=form>n<option selected>Choose a Server</option>";
$query=mysql_query("SELECT * FROM `CES` WHERE `Name` IS NOT NULL");
while($row = mysql_fetch_array($query)) {
echo "<option value='{$row['Server']}'> {$row['Name']}</option>";
//echo "<option value=\"" . $row[server] . "\">" . $row[NAME] . "</option>";
}
?></div>
</select>
<input type="submit" VALUE="Submit">
</form>
Thanks