【发布时间】:2018-11-02 09:09:05
【问题描述】:
我有一个表单,它通过 php 的 echo 函数从表格中显示点击值。回显逻辑如下:
//reading input
if(isset($_POST['add'])){
$scrid=$_POST['sc'];
$desc=mysqli_real_escape_string($_POST['desc']);
$cb=mysqli_real_escape_string($_POST['created']);
$version=mysqli_real_escape_string($_POST['version']);
if($scrid !=0){
if(empty($desc)){$result="Description cannot be Empty";}
elseif(empty($cb)){$result="Created By cannot be Empty";}
elseif(empty($version)){$result="Version cannot be Empty";}
else{
echo $t."empty";
$sql="INSERT INTO testmaster(ScreenID,Description,createdBy,version) VALUES('$scrid','$desc','$cb','$version');";
if(mysqli_query($link,$sql)){
header('Location: testmaster.php');
}else{
echo "Query failed";
}
}
}
}
//passing table values,,,,, works perfectly fine...
if(mysqli_num_rows($sol)>0){
while($row=mysqli_fetch_assoc($sol)){
echo"<tr>";
echo"<td><a href=testmaster.php?testid=".$row['tid'].">".$row['Description']."</a></td>";
echo"<td>".$row['createdBy']."</td>";
echo"<td>".$row['version']."</td>";
echo "</tr>";
}
}
}
if(isset($_GET['testid'])){
$t=$_GET['testid'];
$query="SELECT * FROM testmaster WHERE tid='$t';";
if($sol=mysqli_query($link,$query)){
$modif=mysqli_fetch_assoc($sol);
$d=$modif['Description'];
$c=$modif['createdBy'];
$v=$modif['version'];
$sc=$modif['ScreenID'];
}
//These are the input fields
echo'<td><textarea name="desc" class="form-rounded" cols=50 rows=2
placeholder="Description">'.$d;
echo'</textarea></td>';
echo'<td><input type="text" name="created" class="form-control"
placeholder="Created By" value='.$c.'>';
echo'</td>';
//cancel
echo "<input type='reset' class='btn button2' name='cancel' id='cancel' value='Cancel' style='height:12px; text-align:center; margin-left:10px;' >" ;
取消按钮和Clear text field value in JQuery 中指定的javascript 代码都不起作用。
我猜是因为我附和了它。 有人可以帮我吗? 在此先感谢.... :)
附:所有输入字段和取消按钮都在里面...
【问题讨论】:
-
你的
cancel按钮javascript代码在哪里?给我们看看。 -
你有
<form>标签吗?没有一个重置输入类型不会有太大作用。 -
@iainn.. 是的,我愿意。
-
@SurkaavS 对,你能用 complete 代码更新问题吗?如果您发布的只是摘录,那么任何人都很难帮助您。
-
正在使用不安全的查询。这个问题有 2 个赞成票,因为....?清楚吗?它是否在 singke 引用的字符串中回显变量?