06-02-2011, 10:00 PM
|
#1 (permalink)
|
|
The Wanderer
Join Date: May 2011
Posts: 9
Thanks: 0
|
hwo to select forgin key to insert to another table
hi guys
im beginner in php
i have another question
how to insert foreign key to another table to insert
i use like this for my form that have staff_id and password
my form of login :
<form action="2.php" method="post">
staff_id : <input type="text" name="staff_id" />
STAFF_PASSWORD: <input type="text" name="STAFF_PASSWORD" />
<input type="submit" name="login" value="login"/>
</form>
and for php
i use like this :
Welcome <?php echo $_POST["staff_id"];
include("config.php");
$result = mysql_query("SELECT staff_id FROM orders WHERE staff_id=('SELECT staff_id FROM staffs ')");
?>
<table class="table">
<form action="11.php" method="post">
<tr>
<th class="th">ORDER_DESC </th>
</tr>
<tr>
<td class="td"><input type="checkbox" name="checkbox[]" value="CSF"/> CSF </td>
</tr>
<tr>
<td class="td"><input type="checkbox" name="checkbox[]" value="LFT"/> LFT </td>
</tr>
<tr>
<td class="td"><input type="checkbox" name="checkbox[]" value="RFR"/> RFR </td>
</tr>
<tr>
<td class="td"><input type="checkbox" name="checkbox[]" value="TFT"/> TFT </td>
</tr>
<tr>
<td class="td" ><input type="submit" value="Submit" name="Submit"/>
</td>
</tr>
</form>
</table>
i using nested select but no relation between two db so i have table called orders that have staff_id is forign key
can any help and tnx for solving my problem
|
|
|
|