gpt4 book ai didi

javascript - $_POST ['projectSubmit'] 不工作

转载 作者:行者123 更新时间:2023-11-28 13:18:09 24 4
gpt4 key购买 nike

在点击提交按钮后,我尝试回显 JavaScript 以确保其正常工作,但它只会关闭模式并刷新页面。怎么了?我也尝试过'if($_POST[projectSubmit'] 而是将其包含在 isset() 上。但它无法识别索引 'projectSubmit'

<form action="" method="POST">
<div id="modal1" class="modal modal-fixed-footer" style="width:35%;">
<div class="modal-content">
<h4>Create Project</h4>
<div class="row">

<div class="input-field col s12">
<i class="material-icons prefix">perm_identity</i>
<input type="text" name="projectName" class="validate">
<label for="projectName" class="">Project Name</label>
</div>

<div class="input-field col s12">
<i class="material-icons prefix">room</i>
<label for="projectLocation">Location</label>
<input type="text" name="projectLocation">
</div>

<div class="input-field col s12">
<label for="projectType">Project Type</label><br>
<input name="projectType" type="radio" value="Condominium" id="test1" />
<label for="test1" class="black-text">Condominium</label>

<input name="projectType" type="radio" value="Housing" id="test2" />
<label for="test2" class="black-text">Housing</label>
</div>

</div><!--ROW-->


</div>
<div class="modal-footer">
<input type="submit" name="projectSubmit"class="waves-effect waves-green btn-flat" value="s">
<button type="RESET" class="btn btn-flat">RESET</button>
</div>
</div>
<?php
if(isset($_POST['projectSubmit'])){
echo "<script type='text/javascript>alert('JUJU');</script>";

}
else{
echo "<script type='text/javascript>alert('xx');</script>";
}


?>


</form>

最佳答案

您尚未完成 text/javascript 后面的单引号。请更新如下:

echo "<script type='text/javascript'>alert('JUJU');</script>";

与更新第二个 echo 相同:

echo "<script type='text/javascript'>alert('xx');</script>";

关于javascript - $_POST ['projectSubmit'] 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35839728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com