Php 是否将下拉值发布到mysql?
有人可以告诉我,我将如何张贴选择下拉值沿我的文本输入值到mysql数据库 我有以下内容,不确定应该如何处理下拉值 谢谢Php 是否将下拉值发布到mysql?,php,html,mysql,Php,Html,Mysql,有人可以告诉我,我将如何张贴选择下拉值沿我的文本输入值到mysql数据库 我有以下内容,不确定应该如何处理下拉值 谢谢 <form action=\"includes/welcomestats.php\" method=\"post\" id=\"form1\"> <input type=\"text\" name=\"location\" id=\"location\" maxlength=\"30\" placeholder=\"Locat
<form action=\"includes/welcomestats.php\" method=\"post\" id=\"form1\">
<input type=\"text\" name=\"location\" id=\"location\" maxlength=\"30\" placeholder=\"Location: e.g. London\">
Enter Your Location</label><br/>
<br/>
<input type=\"text\" name=\"local_station\" id=\"local_station\" maxlength=\"30\" placeholder=\"Local Train Station\"><label> Enter a Local Train Station</label><br/><br/><br/>
<h5>About You</h5><br/>
<select name=\"formGender\" style=\"min-width:125px;\">
<option value=\"\">Select...</option>
<option value=\"M\">Male</option>
<option value=\"T\">Female</option>
</select>
<label> Enter Your Gender</label>
<br/><br/>
<input type=\"submit\" class=\"welcome-submit2\" name=\"submit\" value=\"Next ->\" id=\"submit\"/>
</form>
<?php
require_once("session.php");
require_once("functions.php");
require('_config/connection.php');
?>
<?php
session_start();
include '_config/connection.php';
$location = $_POST['location'];
$result = mysql_query("SELECT location FROM ptb_profiles WHERE id=".$_SESSION['user_id']."");
if(!$result)
{
echo "The username you entered does not exist";
}
else
if($location!= mysql_result($result, 0))
{
echo "";
$sql=mysql_query("UPDATE ptb_profiles SET location ='".addslashes($display_name)."' WHERE id=".$_SESSION['user_id']."");
}
输入您的位置
进入本地火车站
关于你
选择。。。
男性
女性
输入您的性别
选择字段值的处理方式与任何其他字段相同。因此,如果您选择了如下字段-
<select name=\"formGender\" style=\"min-width:125px;\">
<option value=\"\">Select...</option>
<option value=\"M\">Male</option>
<option value=\"T\">Female</option>
</select>
更新
这会给你M或F。它会给你M或F,而不是男性或女性
$gender = $_POST['formGender']