dswqw66280 2017-02-09 02:51
浏览 14

在注册表格中添加额外的下拉列表

i am modifying a social script and we want to add extra field in registration form for job :

<div class="form-group">
<label for="job">{__("My Job")}</label>
<select name="job" id="job" class="form-control" required>
<option value="none">{__("Select Job")}:</option>
<option value="designer">{__("designer")}</option>
<option value="programmer">{__("programmer")}</option>
<option value="it">{__("it")}</option>
<option value="coder">{__("coder")}</option>

i tried many things to add the extra field to be added to the database but it always give me an error in registration page : http://doctown.net/signup

and this script has a user class file can be downloaded from here : http://doctown.net/class-user.zip

so i tried to use :

if(isset($_POST['formSubmit'])) 
{
$aJob = $_POST['user_Job'];
if(!isset($ajob)) 
{
echo("<p>You didn't select any job!</p>
");
} 
else
{
$nJob = count($ajob);
echo("<p>You selected $nJob job: ");
for($i=0; $i < $nJob; $i++)
{
echo($aJob[$i] . " ");
}
echo("</p>");
}
}

but it didnt work and many many other ways without any luck

what the function should i use ?

  • 写回答

1条回答 默认 最新

  • douzhi1879 2017-02-09 03:09
    关注

    You should get:

    $aJob = $_POST['job'];
    

    instead

    And please take note that if the doesn't select job, the job parameter is 'none'

    BTW:

    $nJob = count($ajob);
    

    This may not work as the user could only select 1 job. The data sent to the server is a string

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法