我正在尝试使用PHP从html中的select标签中获取值,但它一直说索引未定义。
我的HTML表单:
<form method="POST" action="proceso.php">
<label for="language">Idioma</label>
<select id="language" name="prueba">
<option value="es_LA">Español</option>
<option value="en_US">English</option>
</select>
<br>
<label for="username">Nombre de usuario</label>
<input type="text" name="username" id="username">
<br>
<label for="password">Contraseña</label>
<input type="password" name="password" id="password">
<br>
<label for="email">Correo electrónico</label>
<input type="email" name="email" id="email">
<br>
<label for="genderM">Masculino</label>
<input type="radio" name="gender" id="genderM" value="M">
<label for="genderF">Femenino</label>
<input type="radio" name="gender" id="genderF" value="F">
<label for="genderO">Otro</label>
<input type="radio" name="gender" id="genderO" value="O">
<br>
<button type="submit">Enviar</button>
</form>
这就是我试图在procesos.php文件中获取值的方法:
$sql = "INSERT INTO account(username,userpass,email,gender) VALUES('$_POST[prueba],'$_POST[username]','$_POST[password]',$_POST[email]',$_POST[gender]')";
错误说明:注意:未定义的索引:prueba
答案 0 :(得分:0)
On&#34; INSERT INTO帐户(用户名,userpass,电子邮件,性别)&#34;在这里,您接受4变量,但是您正在传递&#39; $ _ POST [prueba]&#39;,&#39; $ _ POST [用户名]&#39;,&#39; $ _ POST [密码]&#39 ;,&#39; $ _ POST [邮件]&#39;&#39; $ _ POST [两性]&#39;五,查询