Jump to content

messagebox system


conan318

Recommended Posts

iam making a message where if you click on a members profile you can send them a message and it fill out the to and from form automaticly which is working but i cant get it to work when you press reply to add sending details.. hope that makes sense.

viewprofile.php

Echo '<a href="new_message.php?username=' . $info['username'] . '">"message me"</a><br>';

when u click message me from the user profile it carry's over the user name no problems.

 

 

now if your just read a message and wish to reply

read_message.php

session_start();
$myusername=$_SESSION['myusername'];
require "database.php";
$getuname = $_GET['from_user'];
$messageid = $_GET['messageid'];
$message = mysql_query("SELECT * FROM messages WHERE message_id = '$messageid' AND to_user = '$myusername'");
$message=mysql_fetch_assoc($message);


echo "<h1>Title: ".$message['message_title']."</h1><br><br>";
echo "<h3>From: ".$message['from_user']."<br><br></h3>";
echo "<h3>Message: <br>".$message['message_contents']."<br></h3>";

echo '<form name="backfrm" method="post" action="inbox.php">';
echo '<input type="submit" value="Back to Inbox">';

// trying to carry over the the form_user to the next page
Echo '<a href="new_message.php?from_user=' . $getuname['from_user'] . '">"Reply to message"</a><br>';
//
?>

new message page.

if (!isset($_GET['username'])) {
$getuname = mysql_real_escape_string($_GET['username']);
}else{
$getuname = mysql_real_escape_string($_GET['from_user']);
}



?>


<form name="message" action="messageck.php"
method="post">
Subject:<input type="text" name="message_title">  <br>
<?
echo '<input type="hidden" name="message_to" value="'.$getuname.'"><br>';
?>
Message: <br>
<textarea rows="10" cols="50" name="message_contents">
</textarea>
<?php
echo '<input type="hidden" name="message_from" value="'.$myusername.'"><br>';

 

Link to comment
Share on other sites

Give this a shoot. Change:

Echo '<a href="new_message.php?from_user=' . $getuname['from_user'] . '">"Reply to message"</a><br>';

 

to these two lines:

 

$person = $getuname["from_user"];

echo "<a href=\"test_second.php?from_user=$person\">Reply to message</a><br>";

 

to cut down on the quotes ( a source of anguish for me and many others)

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.