Hi,
During the last days I wrote this little script with the help of the users of this forum, it works and read the database field into form but when I call another php file (select1.php) in otder to print the selected item from the form it does not work.
Can any one explain me why and how to fix it.
Thanks again.
Mysql2form.html
<HTML>
<HEAD>
<TITLE>mysql2form</TITLE>
</HEAD>
<BODY>
<?
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'p';
$table = 'l';
$connection = mysql_connect($host,$user,$pass) or die("Couldn't make
connection.");
$datab = mysql_select_db($db, $connection) or die("Couldn't select database.");
$sql = "SELECT name FROM $table";
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$line = $row["name"];
$block .= "<OPTION value=\"$line\">$line</OPTION>";
}
?>
<FORM action="http://localhost/print1.php" method="GET" >
search:<br>
<select name=vari>
<? echo "$block";?>
</select>
<P><INPUT type="submit" value="submit"></p>
</FORM>
</BODY>
</HTML>
print1.php
<html>
<head>
</head>
<?php
$n=$_GET['vari'];
echo $n;
?>
</body>
</html>