Jump to content

Multi Page Inbox help


Shadowing

Recommended Posts

So far with my inbox I got it to grab the message and display them in order by most recently sent.

but now I want to add multiple inbox pages and set a limit on how many messages are on each page. I cant think of the idea behind of doing it. If someone could kindly guide me please. I know i need to use tokens in the link for each page but i dont understand the concept behind having newest messages to oldest showing up on each page

 

 

 

 

 <?php 

				$take3 = "SELECT time_offset FROM users WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'"; 
				$take2 = mysql_query($take3) or die(mysql_error());
				$take1 = mysql_fetch_array($take2);

		$result = mysql_query("SELECT * FROM pm WHERE id = '".($_SESSION['user_id'])."' ORDER BY time DESC");

		// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {

		$pm_id = $row['pm_id'];
		$msggoauld = $row['sentfrom'];
		$subject = $row['subject'];
		$recieved = $row['time'];

		$time = ($recieved + $take1['time_offset']);

                date_default_timezone_set('UTC');

                               $offset = date('m/d/Y/H:i:s', $time);          
            
?>
      <tr>
      <td><center><input type="checkbox" name="messageid" class="select-all-box" value="327990" ?></center></td>

    </label></td>
       
    <td><center><a href="search_goaulds.php?goauld=<?php echo $msggoauld; ?>"><?php echo $msggoauld ?></a></center></td>  
    
       <td><center><a href="view.php?pm_id=<?php echo $pm_id; ?>"><?php echo $subject ?></a></center></td>
        
    <td><center><?php echo $offset ?></center></td>
      
    </tr>
        <?php } // while loop 
        ?>
    </table>
    <p> </p>
  </center>
  </p>
</form>  

Link to comment
Share on other sites

oh wow! thank you alot Pikachu. I had no idea it was called that

 

I have one more question about keeping people from sending blank messages.

Ive never had problems before with keeping blank forms from being submited. This is the first time using <textarea> for me.

for some reason it ignores the code below and i even tried

if (!isset($_POST['message_content'])) {

 

 

 <?php if(empty($_POST['message_content'])) {
echo "cant send blank messages";
?>
<textarea rows="16" cols="65" name="message_content" id="message_content">

</textarea>  

Link to comment
Share on other sites

oh so it shouldnt be happening then. hmm

i did notice something else wierd too when im on the subject input and hit tab to tab down into the textarea it skips the first line in the text area

 

 <?php


if(isset($_POST['send'])) {

				$send3 = "SELECT goauld,id FROM users WHERE goauld='".mysql_real_escape_string($_POST['message_to'])."'";
				$send2 = mysql_query($send3) or die(mysql_error());
				$send1 = mysql_fetch_array($send2);

				$from3 = "SELECT goauld FROM users WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'";
				$from2 = mysql_query($from3) or die(mysql_error());
				$from1 = mysql_fetch_array($from2);
  
				$goauld_name = $_POST['message_to'];

				$phptime = time();
				$to = $_POST['message_to'];
				$from = $from1['goauld'];
				$subject = $_POST['subject'];
				$id = $send1['id'];
				$message = $_POST['message_content'];




	if(empty($send1['goauld'])) {

        	       		echo "This Goauld doesnt exist";
       	}else{
       		
       		if(empty($_POST['message_content'])) {
       		
       				echo "You cant send a blank message";

}else{		

$mail2 = "INSERT INTO pm SET pm_id = '', sendto = '".mysql_real_escape_string($to)."', sentfrom = '".mysql_real_escape_string($from)."' , subject = '".mysql_real_escape_string($subject)."' , id= '".mysql_real_escape_string($id)."', message= '".mysql_real_escape_string($message)."', time= '".mysql_real_escape_string($phptime)."'";		
$mail1 = mysql_query($mail2);


echo "Your message has been sent to $goauld_name";




	}

}


}

?>


<table width="28%" height="0" border="0">
  
<tr>

    <td height="0" align="center"><a href="inbox.php">Inbox</a>
    </td> <td height="0" align="center"><a href="compose.php">Compose</a></td>
     <td height="0" align="center"><a href="sent.php">Sent</a></td>
      <td height="0" align="center"><a href="trash.php">Trash</a></td>
  </tr>
  <tr>
</tbody>
</table>
</form>

<form name="message" action=""

method="post">

<input type="text" name="message_to" id="message_to" onfocus="if(this.value=='Name')this.value='';" value="<?php echo htmlspecialchars($_GET['goauld']);?>"> To: <br>

<input type="text" name="subject" id="subject" > Subject: <br>

Message: <br>

<textarea rows="16" cols="65" name="message_content" id="message_content">

</textarea>

<input type="submit" name="send" id="send" value="Send">

</tbody>
</table>
</form>
</body>
</html> 

Link to comment
Share on other sites

Hey Pikachu your "Why $_SERVER['PHP_SELF'] is bad" link isnt working must not exist anymore.

 

I notice the tutor you linked me for Pagination uses $_SERVER['PHP_SELF']

either way thank you so much to pointing me that link

I got it all working.

 

I have a few small bugs in the links though that i need to sort out.

will try to fix it on my own first

 

what did you mean by trimming the incoming data? never heard that term before

Link to comment
Share on other sites

oh my bad i thought you meant it to go to a site other then a google search result lol.

and I thought maybe the site didnt exist so google forward it into a search result or something.

 

anyways you was right what was wrong with the space issue and me not being able check for a empty field. All fixed :)

and thanks for explaining that to me melloorr

 

I'll mark this as solved, im going to start using the solve feature on the forum. going to even go back and do it on past posts ive posted.

 

incase someone else has this issue with textarea with html i solved it by not having any spaces between id="message_content"> and </textarea>

 

 <textarea rows="16" cols="65" name="message_content" id="message_content"></textarea> 

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.