now i using one php file to echo out from database for most of my different page when i select from the menu. and i assign different id to different info. but the information in database is by inserting inside.
now i want to create a html in same page with box to insert the information and let it add on to my database and display today.
but i not sure how to make it into my database and let different page just display the information that shd be on the page
for example if i select Bp and insert information on the box, the information shd oni display in Bp and not other page
This is my part of my main code
Code: Select all
<?php
require('db.php');
mysql_connect(MACHINE, USER, '');
mysql_select_db(DBNAME);
$id = $_POST['id'];
$from = $_POST['from'];
$where = $_POST['where'];
$to = $_POST['to'];
$description = $_POST['description'];
$sql = "INSERT INTO where ( 'id', 'from', 'where', 'to', 'description')VALUES ( 'NULL', '$from', '$where', '$to', '$description')";
$menu = (int) @$_POST['menu'];
$sql = "SELECT * FROM where WHERE id = $menu";
$res = mysql_query($sql) or die(mysql_error());
//$row = mysql_fetch_array($res);
while($row = mysql_fetch_array($res)){
echo "<tr>";
echo "<td>";
echo "From" . " " . $row[from]. "," . " ";
echo "Please" . "<BR>" . $row[route];
echo " " . "to" . " " . $row[to];
echo "<BR>" . $row[description], ".";
echo "</table>";
}
?>
<h3>Feel free to add!!!</h3>
<h3> </h3>
<h3> Route:<br />
<textarea name="where" cols="50" rows="5" height="55"></textarea>
<br />
<p> </p>
</h3>
<h3>Description:<br />
<textarea name="description" cols="50" rows="5" height="55"></textarea>
<br />
<br />
<input type="submit" value="Submit" name='sub' />
</h3>
<p class="style2">Where you want: </p>
Please select
<form name="jump" action="where.php" method="post">
<select name="menu" size="3">
<option value="1">Bp</option>
<option value="2">S</option>
<option value="3">CT</option>
<option value="4">BG</option>
</select>
<input type="submit" value="GO">
</p>