komquat Posted December 13, 2006 Share Posted December 13, 2006 I have done this hundreds of times before, but it seems it is not working now, and i am not sure whyhere is my long code:[code=php:0]<?//Session Startingsession_start();include("include/connection.php");//Add info to the DBif (($_POST['sub_gbook'] == "yes") and ($_POST['gbook_pass'] == "k7c6")) { $sql_update = "INSERT INTO gbook (gb_name, gb_location, gb_date, gb_email, gb_website, gb_comment) VALUES ('$_POST[gbook_enter_name]', '$_POST[gbook_enter_location]', '$_POST[gb_date]', '$_POST[gbook_enter_email]', '$_POST[gbook_enter_website]', '$_POST[gbook_enter_comment]') "; $result = mysql_query($sql_update, $connection) or die ("Could not Execute query. Reason: ".mysql_error()); $msg = "Entry Added";} else if (($_POST['sub_gbook'] == "yes") and ($_POST['gbook_pass'] != "k7c6")) { $msg = "<font color='red'>Wrong Pass Code, please try again</font>"; $msg .= $_POST['gbook_pass']; $msg .= $_POST['gb_name'];}//Display if adding a new entryif ($_POST['add_gb'] == "yes") { $gb_date = date("m/d/y"); $gbook_display = " <form method='post'> <input type='hidden' name='sub_gbook' value='yes'> <input type='hidden' name='add_gb' value=''> <input type='hidden' name='gb_enter_date' value='$gb_date'> <table align='center' border='1'> <tr> <td>Name:</td> <td><input type='text' name'gb_name' size='40' value=''></td> </tr> <tr> <td>Location:</td> <td><input type='text' name'gb_enter_location' size='40'></td> </tr> <tr> <td>Email:</td> <td><input type='text' name'gb_enter_email' size='40'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name'gb_enter_web' size='40'></td> </tr> <tr> <td align='center' colspan='2'>Comment</td> </tr> <tr> <td align='center' colspan='2'><input type='text' name'gb_enter_comment' size='100'></td> </tr> <tr> <td align='center'><img src='images/password.jpg' border='0'></td> <td><input type='password' name'gbook_pass' ></td> </tr> <tr> <td align='center' colspan='2'><input type='submit' name='submit' value='Add Comment' size='6'></form></td> </tr> </table>";} else { //Select all information from gbook db and display it in a table$sql_gbook = "SELECT * FROM gbook ORDER BY gbook_id DESC";$qry_gbook = mysql_query($sql_gbook, $connection) or die("Could not Execute gbook query. Reason: ".mysql_error()); while ($info = mysql_fetch_array($qry_gbook)) { $gbook_disp_id = $info[gbook_id]; $gbook_disp_name = $info[gb_name]; $gbook_disp_location = $info[gb_location]; $gbook_disp_date = $info[gb_date]; $gbook_disp_email = $info[gb_email]; $gbook_disp_website = $info[gb_website]; $gbook_disp_comment = $info[gb_comment]; $gbook_display = " <table align='center' width='700' border='1'> <tr> <th align='center' width='175'><strong>From</strong></th> <th align='center' width='525'><strong>Comments</strong></th> </tr> <tr> <td align='left'><strong>$gbook_disp_name</strong><br> When:<em> $gbook_disp_date</em><br> From:<em> $gbook_disp_location</em><br> E-mail:<em> $gbook_disp_email</em><br> Website:<em> $gbook_disp_website</em> </td> <td>$gbook_disp_comment</td> </tr> </table><br>"; } }?>[/code]Thank you all Quote Link to comment Share on other sites More sharing options...
fert Posted December 13, 2006 Share Posted December 13, 2006 in your query try replacing all the '$_POST[name]' with '{$_POST['name']}' Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted December 13, 2006 Share Posted December 13, 2006 What exactly isn't working? What is the expected result, and what is the actual result? "POST variables not working" doesn't really narrow it down any. Quote Link to comment Share on other sites More sharing options...
edg322 Posted December 13, 2006 Share Posted December 13, 2006 what are your post variables supposed to do? Quote Link to comment Share on other sites More sharing options...
komquat Posted December 13, 2006 Author Share Posted December 13, 2006 IDIOT alert!!! I forgot the = sign for the name of each input!!!!!The post calls up the value on the next refreshI got it! Thanks all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.