First off thanks in advance, everyone here has been a great help in the past and know you will be this time..
What i'm trying to achomplish is to submit data from a form into multipule tables in the Mysql DB. However I want the user to select which table the data gets inserted too by using check boxes..
I got the insert working but using the checkboxes are a little past my knowledge base.
Here is the insert code i have so far
<?php
require('FC_DB_connection.php');
//check if form has been submited
if(isset($_POST['submit'])){
//new code sent from form
$code=$_POST['code'];
//to protect from mysql injections
$code = stripslashes($code);
//inserting data order
$order = mysql_query("SELECT * FROM imob WHERE code='$code'");
if(mysql_num_rows($order) > 0 ){
echo "code already in DB";
}
else if(mysql_query("INSERT INTO table1 (code, time)
VALUES ('$code', NOW())"));
//declare in the order variable
$result = mysql_query($order); //order executes
if($result){
echo("<br>New Code added");
}
}
?>
Form code:
<form name="addcode" action="<?php $_SERVER['PHP_SELF'];?>" method="POST">
<br />
<input name="code" type="text" value="Enter Code">
<br />
1:<input type="checkbox" name="1">
2:<input type="checkbox" name="2">
3:<input type="checkbox" name="3">
4:<input type="checkbox" name="4">
<br />
<input type="submit" name="submit" value="Add Code">
</form>
so basically the data from the text box needs to be inserted into all the tables where a checkbox is checked.