Ok, I know what you are thinking, "Oh, this is easy" BUT what I want to do might not be as easy as you think.
Here is what I want to do. I am making an html page that accepts input from users via a form text box, but I also want to have 2 dropdown menus. One will have a list of buildings, and one will have a list of types of products (This is for inventory). The HTML page will then send the variables from both the users text input and the users dropdown menu input to a php file that will then put that info into a mysql database. I have it working now with only ONE dropdown menu, but I need more than one. This is what I have so far.
insert.html:
Code:
<html>
<body>
<form action="inserttest.php" method="post"> <!-- name="myform" onSubmit="return dropdown(this.typen)"> -->
Building Abbreviation: <input name="buiab" type="text" /><br />
Building Name: <select name="formVar1" onchange="document.myform.formVar1.value=this.value"><!-- <input name="build" type="text" /><br />-->
<option value="">Select a Building</option>
<option value="Art">Art</option>
<option value="Cadet">Cadet</option>
<option value="Computer Engineering Building">Computer Engineering Building</option>
</select><br />
Room Number: <input name="roomnum" type="text" /><br />
Type: <select onchange="document.myform.formVar.value=this.value">
<option value="Display (Podium)">Display (Podium)</option>
<option value="Computer (Podium)">Computer (Podium)</option>
<option value="Computer (Lab)">Computer (Lab)</option>
<option value="Display (Lab)">Display (Lab)</option>
</select><br />
Make: <input name="maken" type="text" /><br />
Model: <input name="modeln" type="text" /><br />
Serial: <input name="serialnum" type="text" /><br />
Special: <input name="specialnum" type="text" /><br />
Comments: <input name="commentst" type="text" /><br />
<input type="hidden" name="formVar1" value="">
<input type="hidden" name="formVar" value="">
<input type="submit" value="Send form!">
</form>
</body>
</html>
insert.php:
Code:
<?php
include 'config.php';
include 'opendb.php';
$buildab = $_POST['buiab'];
$room = $_POST['roomnum'];
$make = $_POST['maken'];
$model = $_POST['modeln'];
$serial = $_POST['serialnum'];
$special = $_POST['specialnum'];
$comment = $_POST['commentst'];
$type = $_POST['formVar'];
$building = $_POST['formVar1'];
$query = "INSERT INTO $dbtable VALUES ('$buildab', '$building', '$room', '$type', '$make', '$model', '$serial', '$special', '$comment');";
echo $query, "<br />";
include 'closedb.php';
?>
Please note, my inserttest.php works perfectly fine if I have just text boxes in my inserttest.html, or if I only have 1 dropdown menu. I know if has something to do with my formVar and formVar1 in my inserttest.html. Please look at that first.
Thanks,
DragonM15