Jump to content

POST variables not working


komquat

Recommended Posts

I have done this hundreds of times before, but it seems it is not working now, and i am not sure why

here is my long code:

[code=php:0]
<?
//Session Starting
session_start();

include("include/connection.php");

//Add info to the DB
if (($_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 entry
if ($_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
Link to comment
https://forums.phpfreaks.com/topic/30427-post-variables-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.