Hello All,
Ive tried searching on this forever but have not been able to find anything.
I also posted on another site with no luck.
Maybe someone here can help.
I have a text area on a form where there will be several entries put in to the text area on different lines. I have it working where this is being inserted into a MySQL database and it works. However I need to submit other values as well, but these will be the same for each entry. Let me explain.
The website admin will paste codes in the text area. They are unique and will be on different lines. On the same form there will be other values. Those will duplicate on each codes database entry.
Here is what i have going on so far.
FORM:
<form id="addbulkkeys" name="addbulkkeys" method="post" action="">
<textarea name="area" id="area" cols="45" rows="5"></textarea></td>
<input type="submit" name="button" id="button" value="Add Keys" />
<input type="hidden" name="addedby" id="button" value="<?php echo $userid ?;>" />
<input type="hidden" name="addeddate" id="button" value="<?php echo $date ?;>" />
<input type="hidden" name="MM_insert" value="addbulkkeys" />
</form>
MySQL Statement
<?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "addbulkkeys")) {
mysql_connect("localhost", "dbusername", "dbpassword") or die("Connection Failed");
mysql_select_db("uno_alwayscpr")or die("Connection Failed");
$values = $_POST['area'];
$array = split("\r\n", $values);
foreach($array as $line){
mysql_query("INSERT INTO keys_inventory(keysnumber) VALUES($line)");
}
}
?>
Right now the text area keys are getting added fine to the databse. multiple rows on the mysql db. How to I place the date value and added by on each row as well?