I've run into absolute brickwall and am really desprate for your help please. I have a MYSQL Database with two Tables called user_comment and the second user_table. When a user register with the site, their details are kept in the user_table. the second table user_comment is so that users who are registered on the user_table can leave comments which will be passed into the user_comment table. HERE IS THE CODE FOR THE SECOND PART, CHECKING IF A USER'S EMAIL EXIST IN the user_table IF SO, PUX THESE DATA INTO user_comment TABLE. PLEASE CAN ANYONE SPOT WHAT IS WRONG WITH THE CODE???


<?php require 'db.private'; ?>
<title> Gizmo&reg; Electronics - Login</title>


<table width="100%">


$connection = mysql_connect($hostname,$username,$password);
mysql_select_db($databaseName, $connection);

$submit = $_POST;
$comment = $_POST;
$email = $_POST;

if(isset($submit))  {

//if(isset($submit))    {
// check if user exists in the database
$query = mysql_query("SELECT email FROM user_table WHERE email = '".$email."'");
//$num_rows = mysql_num_rows($query_email);
//if(!$num_rows) die('Gizmerror!! Either you have typed your USERNAME and or Your PASSWORD incorrectly or you have not registered to access this pages. <p><font color="red" size="+1"><center> Please Try Again</center> </font></p>');

//mysql_query ( "INSERT INTO user_comment (email, comment) VALUES ('$email', '$comment');

$insert = "INSERT INTO user_comment SET
email = '$email',
comment = '$comment'";

//$row_comment = mysql_fetch_Array($query);
die("<META http-equiv=\"Refresh\" content=\"0;url=commentdisplay.php\">");

//die("Thank you for registering.  Your Registration was Successful! You can now login");

//$insert = "INSERT INTO user_comment SET
//comment = '$comment'";


die("Thank you for registering.  Your Registration was Successful! You can now login");


//echo mysql_error();


<form action="comment.php" method="post">
<table summary="comment page">

<td><label for="comment">Your Comment:</label></td>
<td><textarea name="comment" cols="70" rows="5" wrap="VIRTUAL" id="comment" value="comment"></textarea><br /></td>

<td><label for="email">Email Address:</label></td>
<td><input type="text" id="email" name="email"  value="type ur email here"></td>

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


<p><a href="home.htm">...or return to our Homepage</a></p>



It would be helpful if you were to provide the error returned, or a description of what's not working correctly.

27.$submit = $_POST[' '];
28.$comment = $_POST[' '];
29.$email = $_POST[' '];

what is you trying to post?

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.