Here is the form being submitted. This is the "send message" form
<form name="form id="form" method="POST">
Send To:<br>
<input type="text" name="to_user" id="to_user" style="width:729px" value="" /><br />
Subject:<br>
<input type="text" name="subject" id="subject" style="width:729px" value=""/><br />
Message:<br> <textarea name="message" id="message" rows="3" cols="106"></textarea><br />
<input type="submit" name="send" id="send" value="Send" /><br>
<input type="hidden" name="to_userid" id="to_userid" value="<?php print $toid ?>"/>
<input type="hidden" name="userid" id="userid" value="<?php print $user_id; ?>"/>
<input type="hidden" name="from_user id="from_user" value="$username" />
<input type="hidden" name="senddate" id="senddate" value="<?php echo date("l, js F Y, g:i:s a"); ?>"/>
You will not be notified if a message is sent. We are still working on that feature. Messages successfully sent will show in your outbox.
<div> <?php $sent = $_COOKIE['sent']; print $sent ?></div>
<?php
if($_POST['send']){
$to_username = $_POST['to_user'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$to_userid = $_POST['to_userid'];
$userid = $_POST['userid'];
$from = $_POST['from_user'];
$senddate = $_POST['senddate'];
$query = mysql_query("SELECT `id_user` FROM `fgusers3` WHERE `username` ={$to_username}");
if (mysql_num_rows($query)==0){
$row = mysql_fetch_assoc($query);
$toid = $row['id_user'];}
$query1 = mysql_query("SELECT `imagelocation` FROM `fgusers3` WHERE `username` ={$from}");
if (mysql_num_rows($query1)==0){
$row = mysql_fetch_assoc($query1);
$receiveimage = $row['imagelocation'];
echo "<img src='$receiveimage'></a>";
}
$query = mysqli_query($myConnection, "INSERT INTO pm_outbox (userid, username, to_id, to_user, title, content, date) VALUES ('$userid', '$username', '$toid', '$to_username', '$subject', '$message', '$senddate')") or die(mysqli_error($myConnection));
$query = mysqli_query($myConnection, "INSERT INTO pm_inbox (from_id, from_user, title, content, date, userid)
VALUES ('$user_id','$username','$subject', '$message', '$senddate', '$toid')") or die(mysqli_error($myConnection));
header("Location: http://www.yourtechview.com/source/test ... d=$user_id");
my apologies for using ' ' instead of { }
}
?>
</form>
The main thing I am trying to put into the database is a variable called $toid$toid is the user id of the person I am sending the message to.
I am trying to get the database to get the id of the user who's username matches the "send to" part of the form.
Of course this doesn't happen and I keep getting 0
Any help? I can see the messages in my database and sent box but they don't reach the inbox of the receiver.
