为什么我的其他输入值不会插入数据库? [关闭]

问题描述 投票:-3回答:1
php html mysql
1个回答
1
投票
您名为reden的第三个元素不是radio输入。这将用空输入覆盖radio值。

<input type="text" name="reden">

重命名other选项:

<td style="color:white">Other :</td> <td><input type="text" name="reden_other_text" /></td>

您可以使用JS使其行为有所不同。

另外,您的empty检查应使用and而不是or,以确保两个值都不为空。

if (!empty($Groep) && !empty($tijdstip))

并且如果需要也应该检查$reden

您可以使用三元数来确定使用哪一个:

$reden = !empty($_POST['reden_other_text']) ? $_POST['reden_other_text'] : reden_other_text$_POST['reden'];

© www.soinside.com 2019 - 2024. All rights reserved.