# How to insert it to another table of database using the submit to approved?? #
my error is below in the submit to approved..anyhelp guys
Select is working but inserting to another table got error

<table border="1">


<?php
            include("db.php");


            $result=mysql_query("SELECT * FROM reserve");

            echo "<tr><td>Reserve ID</td><td>Month</td><td>Day</td><td>Year</td><td>Event</td><td>Name</td><td>Address</td><td>Phone Number</td><td>Email</td></tr>";

            while($test = mysql_fetch_array($result))
            {

                $id = $test['id'];  
                echo "<tr align='center'>";  
                echo"<td><font color='black'>" .$test['id']."</font></td>";
                echo"<td><font color='black'>" .$test['month']."</font></td>";
echo"<td><font color='black'>" .$test['day']."</font></td>";
echo"<td><font color='black'>" .$test['year']."</font></td>";
                echo"<td><font color='black'>". $test['event']. "</font></td>";
                echo"<td><font color='black'>". $test['name']. "</font></td>";
                echo"<td><font color='black'>". $test['address']. "</font></td>";
                echo"<td><font color='black'>". $test['phone']. "</font></td>";
                echo"<td><font color='black'>". $test['email']. "</font></td>"; 
                echo"<td> <a href ='reserve_edit.php?id=$id'>Edit</a>";
                echo"<td> <a href ='reserve_delete.php?id=$id'><center>Delete</center></a>";?>

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

<?php
if (isset($_POST['submit']))
    {      
    include 'db.php';
                    $month=$_POST['month'] ;
$day=$_POST ['day'];
$year=$_POST ['year'] ;
                    $event=$_POST['event'] ;


         mysql_query("INSERT INTO `reqcalendar`(month,day,year,event) 
         VALUES ('$month','$day','$year','$event')"); 




            }
?>              
                <?php echo "</tr>";


            }
echo "<a href='details.php'>Back <br></a> ";   
echo "<a href='reserve_publish.php'>Add to calendar</a> ";
            mysql_close($conn);
            ?>
</table>

Recommended Answers

All 3 Replies

oh sorry..but how can insert it to another table??

I agree with the older post you have to use
<form > </form> or you have to use button to submit it.
But to insert it to another table.
try removing this "`" (without the quotes) in your INSERT STATEMENT.

and can you please post the error?what did the error prompt.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.