我正在尝试将单选按钮中的值插入数据库。下面是我的js代码:
for (i = 0; i < document.form.repnumber.value; i++)
{
newInnerHTML = newInnerHTML +'Name: <input type=\"text\" name=\"rep' +(i+1) +'\" value=\"\" size=\"50\">*<br> ';
newInnerHTML = newInnerHTML +'Email:<input type=\"text\" name=\"rep' +(i+1) +'\email" value=\"\" size=\"60\"><br> ';
newInnerHTML = newInnerHTML +'UI Alum? <input type=\"checkbox\" name=\"rep' +(i+1) +'\alumn" value=\"alumn\" ><br> ';
newInnerHTML = newInnerHTML +'<b>Break-Out Sessions</b>: *<br>';
newInnerHTML = newInnerHTML +'New Recruiters <input type=\"radio\" name=\"rep' +(i+1) +'\sessions" value=\"1\" checked=\"checked\"><br>';
newInnerHTML = newInnerHTML +'Seasoned Recruiters <input type=\"radio\" name=\"rep' +(i+1) +'\sessions" value=\"2\"><br>';
newInnerHTML = newInnerHTML +'Community Partners <input type=\"radio\" name=\"rep' +(i+1) +'\sessions" value=\"3\"><br><br>';
}
而对于动作页面,代码就像
insert into tablename(rep1sessions ...) values (#rep1sessions#...)
但是现在,在我的数据库中,“会话”列仅显示数字/文本的 0 或 -1,选中/取消选中是/否。我的目标只是在列中显示 1,2,3 三个不同的值。有任何想法吗?