
June 11th, 2003, 12:47 PM
|
|
|
|
Join Date: Apr 2007
Location: Jakobstad, Finland
Posts: 59
Time spent in forums: < 1 sec
Reputation Power: 2
|
|
|
submit button doesn´t work!!
Why does the submit button not work?
when I run the file (user_add.php) this message shows up (before the form):
Notice: Undefined variable: submit in C:WebsitesphpsitephpB6.tmp on line 2
I used php for the first time 2 days ago, so look out for dumb mistakes!!
the code (focus on the submit button!):
php Code:
Original
- php Code |
|
|
|
<?php if ($submit) { include("db_conn.php"); include("kjellmantest.php"); $query = "INSERT INTO forsale (`make`,`model`,`useage`,`price`) VALUES ('$make', '$model', '$useage', '$price')"; } // if the form hasn't been submitted we need to display it else { // here is the form ?> <h1>Machines</h1> <form class="cent" action="<?php PHP_SELF ?>" method="post"> <table class="form" width="70%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2"> Please Enter the Details<br> </td> </tr> <tr> <td> <br> make </td> <td> <br> <input type="Text" name="make"> <br> </td> </tr> <tr> <td> <br> model </td> <td> <br> <input type="Text" name="model"> <br> </td> </tr> <tr> <td> <br> useage </td> <td> <br> <input type="Text" name="useage"> <br> </td> </tr> <tr> <td> <br> price </td> <td> <br> <input type="Text" name="price"> <br> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <input type="submit" name="submit" value="submit"> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </form> <?php } ?> </td> </tr> </table> </td> </tr> </table> </body> </html>
The db_conn.php - file only includes connection to the MySql database... what the heck... here´s the code if for any use..:
php Code:
Original
- php Code |
|
|
|
<?php // variables used to open connection to the database $server = "localhost"; $user = ""; $pass = ""; $db = "kjellman"; // open connection // select database
And the code for kjellmantest.php if needed:
php Code:
Original
- php Code |
|
|
|
<html> <body> <?php include("db_conn.php"); $result = mysql_query("SELECT * FROM forsale", $connection); echo "<table border=1>n"; echo "<tr><td>make</td><td>model</td><td>useage</td><td>price</tr>n"; { } ?> </body> </html>
Thanks in advance!!
|