Php搜索结果不会分配到值中

编程入门 行业动态 更新时间:2024-10-22 23:02:22
本文介绍了Php搜索结果不会分配到值中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想从数据库表中搜索并在HTMl表单上显示,但这些值没有分配给php声明的变量 我尝试过:

i want to search from database table and display on the HTMl form but those values are not assigning to php declared variables What I have tried:

<?php if(isset($_POST['search'])) { $connect= mysqli_connect("localhost","root","1234","latgsjason"); if (mysqli_connect_error()){ echo"Failed to Connect"; } // $result=mysqli_query($connect,"SELECT * FROM customer WHERE veh_regno='$_POST[V_Regno]'"); $Vregno = $_POST['V_Regno']; $query="SELECT 'nic','fullname','address','contact','color' FROM customer WHERE 'veh_regno'=$Vregno LIMIT 1"; $result=mysqli_query($connect,$query); while ($row=mysqli_fetch_array($result)) { $VReg=$row['veh_regno']; $Nic=$row['nic']; $FName=$row['fullname']; $Address=$row['address']; $Contact=$row['contact']; $Color=$row['color']; } mysqli_free_result($result); mysqli_close($connect); } else { $VReg=""; $Nic=""; $FName=""; $Address=""; $Contact=""; $Color=""; } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Manage Account</title> <link rel="stylesheet" type="text/css" href="CSS/Style SheetGeneral.css"> </head> <body> <br><br><br> <table background="Images/Back Ground Images/BG1.jpg" border="2" align="center" width ="825" height="820"> <th align=center valign=center> <form action="ManageAccount.php" method="POST"/> <div class="textcenter1"> <h2>Manage An Account</h2> </div> <br><br> <table border="0"; align="center" width ="655" height="550" > <tr> <td> VEHICLE REGISTRATION NUMBER : </td> <td> <input type="text" name="V_Regno" size="40" value="<?php echo $VReg; ?>"> </td> </tr> <tr> <td> NATIONAL ID : </td> <td> <input type="text" name="Nic" size="40" value="<?php echo $Nic; ?>"> </td> </tr> <tr> <td> FULL NAME : </td> <td> <input type="text" name="F_Name" size="40" value="<?php echo $FName; ?>"> </td> </tr> <tr> <td> ADDRESS : </td> <td> <input type="text" name="Address" size="40" value="<?php echo $Address; ?>"> </td> </tr> <tr> <td> TELEPHONE NUMBER/MOBILE NUMBER : </td> <td> <input type="text" name="Contact" size="40" value="<?php echo $Contact; ?>"> </td> </tr> <tr> <td> COLOR : </td> <td> <input type="text" name="Color" size="40" value="<?php echo $Color; ?>"> </td> </tr> <tr> <td> NIC Attachment :<select name="NicChk"> <option selected="" value="">(New Document?)</option> <option value="yes">YES</option> <option value="no">NO</option> </select> </td> <td> <input type="file" name="Nic_Img" accept="image/*"> </td> </tr> <tr> <td> Registration Certificate : <select name="RCcheck"> <option selected="" value="">(New Document?)</option> <option value="yes">YES</option> <option value="no">NO</option> </select> </td> <td> <input type="file" name="Reg_Cer" accept="image/*"> </td> </tr> <tr> <td></td> <td> <input align="left" type="image" src="Images/Buttons/button_search.png" alt="button" name="search" value="Search" width="110" height="50"/> </form> <!--if submit button and reset button in same <form> will perform the formvalidation which leads the reset button also work as a submit button(wont reset anything)--> <form action="UpdateAccount.php" method="POST"/> <input align="center" type="image" src="Images/Buttons/button_update.png" alt="" name="reset" value="reset" width="110" height="50"/> </td> </tr> </form> </table> </th> </table> <br><br> </body> </html>

推荐答案

_POST ['search'])) { _POST['search'])) {

connect = mysqli_connect(localhost,root,1234,latgsjason); if(mysqli_connect_error()){ echo连接失败; } // connect= mysqli_connect("localhost","root","1234","latgsjason"); if (mysqli_connect_error()){ echo"Failed to Connect"; } //

result = mysqli_query( result=mysqli_query(

更多推荐

Php搜索结果不会分配到值中

本文发布于:2023-11-30 01:23:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648249.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:搜索结果   分配   Php   到值中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!