graham23s Posted August 26, 2007 Share Posted August 26, 2007 Hi Guys, on my private messaging code, i was trying to add a "preview" button when clicked the message is displayed below the box but i don't seem to be able to get the isset to catch it: code: echo '<h1>Send A Private Message To (<a href="userdetails.php?id='.$recipient_id.'">'.$recipient_name.'</a>)</h1> <table with="500" border="1" bordercolor="#000000" cellspacing="0" cellpadding="4" /> <form action="messagesent.php?id='.$recipient_id.'" method="POST" /> <tr> <td align="right"><b>Subject</b></td><td align="left"><input type="text" name="subject" size="70" /></td> </tr> <tr> <td class="head" valign="top"><b>Message</b></td><td align="left"><textarea name="message" rows="10" cols="80" /></textarea></td> </tr> <td colspan="2" align="right"/> <input type="reset" name="reset" value="Reset"> <input type="submit" name="submit" value="Send Message" /> <input type="submit" name="submit_preview" value="Preview it!" /> </td> </table> </form> <br />'; if(isset($_POST['submit_preview'])) { echo "preview box here!!!"; } ?> i must be missing something very simple any help would be appreciated Graham Link to comment https://forums.phpfreaks.com/topic/66712-solved-private-message-preview-box/ Share on other sites More sharing options...
pocobueno1388 Posted August 26, 2007 Share Posted August 26, 2007 Thats strange. I just tested it on my server and it worked just fine.... Is this script named "messagesent.php"? If it isn't, then thats the problem. Link to comment https://forums.phpfreaks.com/topic/66712-solved-private-message-preview-box/#findComment-334249 Share on other sites More sharing options...
graham23s Posted August 26, 2007 Author Share Posted August 26, 2007 Hi Poco? yep the file is named the same, i can send messages fine but was wanting if possible toi echo out a preview of the message on the same page: full code: <?php // another GET.../////////////////////////////////////////////////////////////////// // Get the recipients id...///////////////////////////////////////////////////////// $recipient_id = $_GET['id']; // get the senders id from database...////////////////////////////////////////////// $query1 = "SELECT id FROM `membership` WHERE `username`='$member'"; $result1 = mysql_query($query1) or die (mysql_error()); $row = mysql_fetch_array($result1) or die (mysql_error()); $senders_id = $row['id']; // can't message yourself...//////////////////////////////////////////////////////// if($recipient_id == $senders_id) { stderr("Error","You can't message yourself."); include("includes/footer.php"); exit; } // get the name in a variable...//////////////////////////////////////////////////// $query2 = "SELECT * FROM `membership` WHERE id='$recipient_id'"; $result2 = mysql_query($query2); $rows = mysql_fetch_array($result2); $recipient_name = $rows['username']; $recipient_accepting_pms = $rows['accept_pms']; if($recipient_accepting_pms == 'No') { stderr("Error","This user isn't accepting messages."); include("includes/footer.php"); exit; } // Make the pm box.../////////////////////////////////////////////////////////////// echo '<h1>Send A Private Message To (<a href="userdetails.php?id='.$recipient_id.'">'.$recipient_name.'</a>)</h1> <table with="500" border="1" bordercolor="#000000" cellspacing="0" cellpadding="4" /> <form action="messagesent.php?id='.$recipient_id.'" method="POST" /> <tr> <td align="right"><b>Subject</b></td><td align="left"><input type="text" name="subject" size="70" /></td> </tr> <tr> <td class="head" valign="top"><b>Message</b></td><td align="left"><textarea name="message" rows="10" cols="80" /></textarea></td> </tr> <td colspan="2" align="right"/> <input type="reset" name="reset" value="Reset"> <input type="submit" name="submit" value="Send Message" /> <input type="submit" name="submit_preview" value="Preview it!" /> </td> </table> </form> <br />'; if(isset($_POST['submit_preview'])) { echo "preview box here!!!"; } ?> did that work for you mate? maybe it is me lol Graham Link to comment https://forums.phpfreaks.com/topic/66712-solved-private-message-preview-box/#findComment-334252 Share on other sites More sharing options...
pocobueno1388 Posted August 26, 2007 Share Posted August 26, 2007 Try changing this line: <form action="messagesent.php?id='.$recipient_id.'" method="POST" /> To: <form action="'.$_SERVER['PHP_SELF'].'?id='.$recipient_id.'" method="POST" /> Link to comment https://forums.phpfreaks.com/topic/66712-solved-private-message-preview-box/#findComment-334254 Share on other sites More sharing options...
graham23s Posted August 26, 2007 Author Share Posted August 26, 2007 Thanks a ton mate it works:) Graham Link to comment https://forums.phpfreaks.com/topic/66712-solved-private-message-preview-box/#findComment-334264 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.