Attempting to insert data from select field(s) into MySQL. All database connections are correct as it does submit normal form field data and the only two fields that do not pass data are hostplan and billplan which are dropdown.
<?php
if ($_POST['kriekhost']) {
$db = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");
$query = "INSERT INTO host(fullname, username, email, userhost, userip, hostplan, billplan, registration)
VALUES('".$_POST['fullname']."','".$_POST['username']."','".$_POST['email']."','".$userhost."','".$userip."','".$_POST['hostplan']."','".$_POST['billplan']."', now())";
mysql_query($query);
mysql_close($db);
{
?>
-- HTML --
<?php
}
} else {
?>
<FORM class="forms" name="form" method="post" action="<?=$PHP_SELF?>">
<p>Full Name<br>
<input class="forms" type="text" name="fullname">
</p>
<p>User Name<br>
<input class="forms" type="text" name="username">
</p>
<p>
<SELECT class="forms" name="hostplan">
<OPTION selected>Select Hosting Plan</OPTION>
<OPTION>--------------------</OPTION>
<OPTION value="Advanced">Advanced</OPTION>
<OPTION value="Basic">Basic</OPTION>
</SELECT>
</p>
<p>Email Address<br>
<input class="forms" type="text" name="email">
</p>
<p>
<SELECT class="forms" name="billplan">
<OPTION selected>Select Billing Plan</OPTION>
<OPTION>--------------------</OPTION>
<OPTION value="Monthly">Monthly</OPTION>
<OPTION value="Annually">Annually</OPTION>
</SELECT>
</p>
<p>
<input class="submit" type="submit" name="kriekhost" value="Submit">
<input class="submit" type="reset" name="Reset" value="Clear Form">
</p>
</FORM>
<?php
}
?>