advancedfuture Posted January 10, 2008 Share Posted January 10, 2008 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 https://forums.phpfreaks.com/topic/85428-solved-problem-getting-form-data/ Share on other sites More sharing options...
advancedfuture Posted January 10, 2008 Author Share Posted January 10, 2008 no one ehh? Link to comment https://forums.phpfreaks.com/topic/85428-solved-problem-getting-form-data/#findComment-435897 Share on other sites More sharing options...
advancedfuture Posted January 10, 2008 Author Share Posted January 10, 2008 Figured it out... guess I have to pass all variables via $_POST and my INSERT query was malformed. Link to comment https://forums.phpfreaks.com/topic/85428-solved-problem-getting-form-data/#findComment-435919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.