I have this code and I when the submit button is pressed it will create a new record in the database but wont place any of the data from the form into the new record.? Im kind stumped.
This is what the http link looks like when I pull the page up.
[html]
/mailsend.php?ii d=1
[/html]
This tells the following code which person I am sending a message to.
[php]
<?
include('db.php ');
if ($myID == 0) header("locatio n:login.php");
if ($admin == 0) header("locatio n:login.php");
include("navtop .php");
include("nav.ph p");
include("func.p hp");
connect1();
// this is where I take the data and insert it into the database
_v('mode;i:id') ;
if ($mode=='save') {
pg('msg_from,ms g_to,msg_body,m sg_date,msg_tim e,msg_subject,m sg_subject,msg_ isread,msg_sid, msg_tid');
$qupd = mysql_query("IN SERT INTO `email` VALUES ('0','$name', '$to', '$msg', '$now', '$t', '$subject','0', '$myId','$iid') ") or die(mysql_error ());
goto('mail.php' );
}
$now = date('m/d/Y');
$t = date('h:i A');
// this is the query that gets the current loged in user and data about him or her
$query = mysql_query("SE LECT * FROM `instructors` WHERE id='$myID'") or die(mysql_error ());
$row = mysql_fetch_arr ay($query);
extract($row);
$name = $row['first_name'] . " " . $row['last_name'];
echo "<td width=100% valign=top>
<table border=0 width=100% class=leftMenut op1><td>
</form>
<form method='post' name='frmado' action='mailsen d.php'>
<table border=0 width=99% cellpadding=0 cellspacing=0>
<Td wdith=100%>";
// this is the query that pulls the selected person from the list out of the database
// this data displays just fine on the page
$qi = mysql_query("SE LECT * FROM `instructors` WHERE id='$iid'");
$Row2 = mysql_fetch_arr ay($qi);
extract($row);
$to = $row2['first_name'] . " " . $row2['last_name'];
echo "
<p><br><p><sp an class='text'>Fr om: <b>$name</b></p>
<p><span class='text'>To : <b>$first_nam e $last_name</b></p>
<p><span class='text'>Su bject<br>
<input type='text' size='50' name='subject' value='' id='subject' />
</p>
<p><span class='text'>En ter Message<br>
<textarea name='msg' id='msg' cols=50 rows=15 value=''></textarea>
<input type='hidden' name='mode' value='save'>
<p><input type=submit name='submit' value='Send Message' class='input' ></p>
</td>
</table>";
include('navbot .php');
?>
[/php]
This is what the http link looks like when I pull the page up.
[html]
/mailsend.php?ii d=1
[/html]
This tells the following code which person I am sending a message to.
[php]
<?
include('db.php ');
if ($myID == 0) header("locatio n:login.php");
if ($admin == 0) header("locatio n:login.php");
include("navtop .php");
include("nav.ph p");
include("func.p hp");
connect1();
// this is where I take the data and insert it into the database
_v('mode;i:id') ;
if ($mode=='save') {
pg('msg_from,ms g_to,msg_body,m sg_date,msg_tim e,msg_subject,m sg_subject,msg_ isread,msg_sid, msg_tid');
$qupd = mysql_query("IN SERT INTO `email` VALUES ('0','$name', '$to', '$msg', '$now', '$t', '$subject','0', '$myId','$iid') ") or die(mysql_error ());
goto('mail.php' );
}
$now = date('m/d/Y');
$t = date('h:i A');
// this is the query that gets the current loged in user and data about him or her
$query = mysql_query("SE LECT * FROM `instructors` WHERE id='$myID'") or die(mysql_error ());
$row = mysql_fetch_arr ay($query);
extract($row);
$name = $row['first_name'] . " " . $row['last_name'];
echo "<td width=100% valign=top>
<table border=0 width=100% class=leftMenut op1><td>
</form>
<form method='post' name='frmado' action='mailsen d.php'>
<table border=0 width=99% cellpadding=0 cellspacing=0>
<Td wdith=100%>";
// this is the query that pulls the selected person from the list out of the database
// this data displays just fine on the page
$qi = mysql_query("SE LECT * FROM `instructors` WHERE id='$iid'");
$Row2 = mysql_fetch_arr ay($qi);
extract($row);
$to = $row2['first_name'] . " " . $row2['last_name'];
echo "
<p><br><p><sp an class='text'>Fr om: <b>$name</b></p>
<p><span class='text'>To : <b>$first_nam e $last_name</b></p>
<p><span class='text'>Su bject<br>
<input type='text' size='50' name='subject' value='' id='subject' />
</p>
<p><span class='text'>En ter Message<br>
<textarea name='msg' id='msg' cols=50 rows=15 value=''></textarea>
<input type='hidden' name='mode' value='save'>
<p><input type=submit name='submit' value='Send Message' class='input' ></p>
</td>
</table>";
include('navbot .php');
?>
[/php]
Comment