I am trying to create a form where the variable fields is sent to a database in phpmyadmin. The problem is that the fields in phpmyadmin are blank, as if I hadn't write anything in the form. The code is the following in PHP:
$name = $_POST["name"];
$institution = $_POST["institution"];
$email = $_POST["email"];
$country = $_POST["country"];
$hcp = $_POST["hcp"];
$texto = $_POST["texto"];
$state = $_POST["state"];
$license = $_POST["license"];
$connection = mysql_connect($database_host, $database_username, $database_password);
if(!$connection) { // if our attempt to connect failed
die('Could not connect: ' . mysql_error());
}
mysql_select_db($database_name, $connection) or die("You cannot select data base");
$consulta = ("INSERT INTO `1264`(`name`, `institution`, `email` , `country`, `hcp` , `texto` , `state` , `license`) VALUES ('".$name."','".$institution."','".$email."','".$country."','".$hcp."','".$texto."','".$state."','".$license."');");
echo $consulta; die;
mysql_query($consulta,$connection) or die("You cannot register. Try it later, please.");
And in HTML the format of the form is the following:
<form method="post" action="php/enviar.php">
<span class="texto azul">Name</span><input class="caja texto" name="name" type="text"/><br /><br />
<span class="texto azul">Institution</span><input class="caja texto" name="institution" type="text"/><br /><br />
<span class="texto azul">Email address</span><input class="caja texto" name="email" type="text"/><br /><br />
<span class="texto azul">Country</span><select id="country" class="caja texto" name="country">
<option value="">Country...</option>
<option value="Afganistan">Afghanistan</option>
...
</select>
<div id="fadein">
<span id="usa" class="texto azul inputText">HCP Designation</span><select name="hcp" class="caja inputText texto" disabled>
<option value="des">Designation...</option>
<option value="md">MD</option>
<option value="np">NP</option>
<option value="rn">RN</option>
<option value="other">Other</option>
</select><br /><br />
<span id="texto" class="texto azul inputText">If other, please specify</span>
<textarea class="caja inputText texto" name="texto" disabled></textarea><br /><br />
<span class="texto azul inputText">State of Licensure</span><input class="caja inputText texto" name="state" type="text" disabled/><br /><br />
<span class="texto azul inputText">License number</span><input class="caja inputText texto" name="license" type="text" disabled/><br /><br />
</div>
</form>
Does anybody know why it doesn't accept the fields that I write in the form?