I am very new to PHP. Just started using MySQL, but have been useing SQL for DataBases for a while. (I am also a horriablee Speler) . I also just ordered my PHP and My SQL books, 3 of them to learn.
What I am after is to make a page that I can select data from a DB that I choose the info from a Drop Down. Then submit the data and have all the info come out for an INFO page. I have two (2) items I want to have fro the Drop down. 1. Being Site the other 2. Being EPN.
So far I have read a ton of threads, and tried a bunch of code. But no luck. This is what I have started.
INDEX.PHP FILE
<?php
// open the connection
$conn = mysql_connect("localhost", "username", "password");
// pick the database to use
mysql_select_db("test",$conn);
// create the SQL statement
$sql = "SELECT * FROM Dresden";
// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
$options="";
while ($row=mysql_fetch_array($result))
{
$title=$row["EPN"];
$options.="<option VALUE=\"$id\">".$title.'</option>';
}
?>
<body>
<form action="insert2.php" method="get">
<SELECT NAME=id>
<OPTION VALUE=0>Please choose EPN
<?=$options?>
</SELECT>
<br />
<br />
<input type="Submit">
</form>
</body>
------------------------------------------------------------------------------------------------------------------
SELECT.PHP FILE
<?
$dbhost = 'localhost';
$username="username";
$password="password";
$database="exelon";
$EPN=$_POST['EPN'];
$Component=$_POST['Component'];
$# Of Tubes=$_POST['# Of Tubes'];
// open the connection
$conn = mysql_connect("ironbelly.com", "jason", "1qazxsw2");
// pick the database to use
mysql_select_db("exelon");
$result = mysql_query("select * from Dresden");
mysql_query($query);
while ($row = mysql_fetch_array($result))
echo "Site: $row[Site] <BR> EPN: $row[EPN]<br>";
echo $options;
?>
What am I missing here? I would like the output to be in a table, but that will be later. I want the output to have only the records I pull from the DB to show at the end.
Thanks for any help
Jason