Hello all, I've just started making a inventory database. I'm pretty new to php and mysql. I'm having alittle bit of a dilema, I've had smooth sailing untill I wanted to take the code that Ive written and make it more advanced.
My situation.. I'm trying to take html forms and insert them into the database, Ive found a way to do it but all thats doing is creating another if else and essentially more repeating code. I was wondering if someone could point me in the right direction.. Thanks
Ive got multiple forms taht needed to be passed through to SQL.. TAGNUM is just the name of one of them.
Here is my code
if( isset($_POST['TAGNUM'])){
echo "POSTED :".$_POST["TAGNUM"]."<br>";
$link = mysql_connect("localhost","******","******");
mysql_select_db("inventory",$link);
$query = "insert into inventory (tagnum) values ('".$_POST["TAGNUM"]."')";
mysql_query($query);
}
else {
echo "Unsuccesful passing in VARS";
}
the part thats getting me is adding more fields to this without copy and pasting and just changing some of it.
thanks!!