Jump to content

[SOLVED] private message preview box


graham23s

Recommended Posts

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

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

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.