如何在我的javascript中分离参数值
我已经从php将值发送到onclick事件。下面是通过如何在我的javascript中分离参数值,javascript,Javascript,我已经从php将值发送到onclick事件。下面是通过onclick发送的参数值('I-V类学费,VI-VIII类学费,大学水平,英语,) 如何在javascript参数中进行分隔?我已经给出了我的输出 根据我的情况,我需要验证表单字段。如何在javascript中实现这一点 我用,附加值,我不知道如何删除最后一个参数中的,,以及如何分离参数值 我要求stack团队给出可能的答案 if(class I-V) { some validation here } if(College Leve
onclick发送的参数值('I-V类学费,VI-VIII类学费,大学水平,英语,)
如何在javascript参数中进行分隔?我已经给出了我的输出
根据我的情况,我需要验证表单字段。如何在javascript中实现这一点
我用,
附加值,我不知道如何删除最后一个参数中的,
,以及如何分离参数值
我要求stack团队给出可能的答案
if(class I-V)
{
some validation here
}
if(College Level)
{
some validation here
}
像怀斯一样,我需要做一些验证
注意:在我的参数中,我用,
Here is my form
<?php
if (isset($_POST['tutorsubject']))
{
$v='';
$product = $_POST['segment'];
$_SESSION["segment"] = $product;
foreach($product as $val)
{
$v.=$val.',';
}
print_r($product);
$people = array("Class I-V Tuition", "Class VI-VIII Tuition", "Class IX-X Tuition", "Class XI-XII Tuition","College Level","Engineering Subjects","Technology");for($i=0; $i<count($product); $i++){
if (in_array($product[$i], $people)) {
if($product[$i]=="Class VI-VIII Tuition"){
<tr>
<Td></Td>
<td><p style="color:#06F;"><?php echo $product[$i];?></p></td>
</tr>
<tr>
<td><p style="color:#999; font-size:14px; text-align:right;">Please select your Board :</p></td>
<td> <input type="checkbox" name="eightboard[]" value="cbse" >CBSE
<input type="checkbox" name="eightboard[]" value="cse/Ise">ICSE/ISE
<input type="checkbox" name="eightboard[]" value="State">State
<input type="checkbox" name="eightboard[]" value="International">International
</td>
</tr>
<tr>
<td><p style="color:#999; font-size:14px; text-align:right;">Please select Subject :</p></td>
<td>
<input type="checkbox" name="classeightsubject[]" value="allsubject" >All Subject
<input type="checkbox" name="classeightubject[]" value="science">Science
<input type="checkbox" name="classeightsubject[]" value="maths">Maths
</td>
</tr><!--end of select subject row-->
<?php
}
if($product[$i]=="Class IX-X Tuition"){
?>
<tr>
<Td></Td>
<td><p style="color:#06F;"><?php echo $product[$i];?></p></td>
</tr>
<tr>
<td><p style="color:#999; font-size:14px; text-align:right;">Please select your Board :</p></td>
<td> <input type="checkbox" name="tenthboard[]" value="cbse" >CBSE
<input type="checkbox" name="tenthboard[]" value="cse/Ise">ICSE/ISE
<input type="checkbox" name="tenthboard[]" value="State">State
<input type="checkbox" name="tenthboard[]" value="International">International
</td>
</tr>
<Tr>
<Td colspan="2" align="center"><input type="submit" name="s" value="Proceed to Next Step" style="width:200; background-color:#0000CC;color:#FFFFFF; height:30px;" onclick="return valid('<?php echo $v ?>')" ></Td>
</Tr>
<?php
}
?>
</form>
这是我的表格
请选择您的线路板:
哥伦比亚广播公司
ICSE/ISE
陈述
国际的
请选择主题:
所有科目
科学类
数学
请选择您的线路板:
哥伦比亚广播公司
ICSE/ISE
陈述
国际的
我试图设置问题的格式,但仍然很混乱,你的HTML表单在哪里?请查看我更新的问题。我已经填好表格了。如果你有任何疑问,请问我,我会解释我的代码。我希望你能理解。我是否需要使用正则表达式来删除,有人能指导我如何解决这个问题吗?