Jump to content

[SOLVED] Problem getting form data.


advancedfuture

Recommended Posts

Been working on my message reply form. For some reason after the user hits the reply button I can't get data out of it! All the variables show up blank... So when they hit reply it just puts a new line in my database with all the values set to 0.....

 

<?php
//HOLDS THE $username && $token VALUE'S / and SESSION_START()
include 'session.php';

//Get the username / token / msg ID from the reply button on the message.
$_GET['user'];
$_GET['my_token'];
$msgid = $_GET['messageid'];

include 'dbconnect.php';

//MAKE SURE THAT ONLY THE CORRECT USER CAN REPLY TO AND SEE THE MESSAGE
if($username == $_GET['user'] && $token == $_GET['my_token'])
{
//Retrieve the message from the database so that we can
//see what we are replying to!

$query = "SELECT message, mailSubject, mailFrom FROM mail WHERE msgid = '$msgid'";
$results = mysql_query($query);

while($row=mysql_fetch_array($results))
{
	$msg = $row['message'];
	$subj = $row['mailSubject'];
	$mailFrom = $row['mailFron'];
}

//HTML output box so we can see the message and reply.
echo "<center>";
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" enctype=\"multipart/form-data\" name=\"replyMessage\" id=\"replyMessage\">";
echo "<strong>Subject:</strong><br /><textarea name=\"mailSubject\" cols=\"40\" rows=\"1\" value=\"\">RE: ".$subj."</textarea><br />";
echo "<strong>Message:</strong><br /><textarea name=\"message\" cols=\"40\" rows=\"4\" value=\"\">".$msg."</textarea><br />";
echo '<input type="submit" name="replySubmit" id="replySubmit" value="Reply" />';
echo "</form></center>";
}

//If the Reply button is hit execute this code
//********************************************
if($_POST['replySubmit'] == 'Reply')
{
echo $mailFrom; //SHOWING UP NULL VALUE ?????
echo $username;
echo $_GET['message']; //SHOWING UP NULL VALUE?????
echo $_GET['mailSubject']; //SHOWING UP NULL VALUE?????


//Send the reply message PROBLEM HERE... ALL THESE VALUES GET INPUTTED TO MYSQL AS '0'
$query = "INSERT INTO mail (rcpt, mailFrom, mailSubject, message, opened, timeOpened, timeSent) VALUES (rcpt = '$mailFrom',
mailFrom = '$username', mailSubject = '$mailSubject', message = '$message', opened='n', timeOpened = '', timeSent='time()')";
$results = mysql_query($query);

//IF MESSAGE SUCCESSFULLY SENT
if($results)
{
	echo "Thank you, your response has been sent! <br />";
	header ( "Refresh: 10; inbox.php" );
}

//ANY OTHER REASON REDIRECT TO MESSAGE TO TRY AGAIN
else
{
	echo "Sorry Message Reply Failed <br />";
	header( "Refresh: 0; ".$_SERVER['REQUEST_URI']."" );
}
}

//THIS SECTION IS NOW HANDLED IN SESSION.PHP
//******************************************
//******************************************

//else
//{


//IF TOKEN AND USER ARE NOT AUTHENTICATED THEN
//DONT SHOW THEM ANYTHING!
//echo "Sorry you are not allowed to be here!";
//echo "Redirecting to login page!";
//header( "Refresh: 3; login.php" );
//}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.