Can you come over and help me find out why the form content cannot be added to the database?

2019-01-27 22:49:17
0
4
1573

Why the data submitted by the add form cannot be transferred to the database, and it will be cleared when clicking Add. Comment out the add status at the end to determine if the connection to the database is possible. I have tried everything I can, but I don't know where the problem lies. Could you please help me find out where the problem is? I've been stuck on this problem for a long time. Thank you, thank you, thank you, I am grateful

屏幕截图(15).pngTable

<body>

<div>

<form action="addAction.php?action=add" method="get">

<fieldset>

....

</fieldset>

</div>

<div> <tr>

<td><a href ="../right.php">Return</td>

<td><input type="submit" name="submit" value="Add"></ td>

<td><input type="reset" name="reset" value="Reset"></td>

</tr>

</form>

</div>

action operation

<?php

include '../function/conn.php';


if ($db_select){

switch ($_GET['action']) {

case 'add'://add

$Rnumber = $_POST['Rnumber'];

$Raddress = $_POST['Raddress'];

$Rtype = $_POST['Rtype'];

$Rstate = $_POST['Rstate'];

$Remark = $_POST['Remark'];

$sql = "insert into room (room_id, room_address, room_type, room_state, room_remark) values ​​('$Rnumber', '$Raddress','$Rtype','$Rstate','$Remark' )";

$rw = mysql_query($sql);

echo mysql_error();

if ($rw > 0){

echo "<script>alert('Add successfully');</script>";

                                                                                                                          ‐                              echo "                                                                                    echo " </script>";

                                                                                                                                                                                          

break;

?>



reply all(3)
jjJ

Troubleshoot the problem step by step so you will understand

未完待续。。。

$sql = "insert into room (room_id, room_address, room_type, room_state, room_remark) values ​​('$Rnumber', '$Raddress','$Rtype','$Rstate','$Remark')";

Print this sql statement and go to the mysql management tool to see if it can run.

And "<form action="addAction.php?action=add" method="get">",

You use get to submit the form, and use post to receive the data.

$Rnumber = $_POST['Rnumber'];

$Raddress = $_POST['Raddress'];

$Rtype = $_POST['Rtype'] ;

$Rstate = $_POST['Rstate'];

$Remark = $_POST['Remark'];


韦小宝

How can I help you see it like this? You print it yourself in the background and debug it slowly

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template