message from: blalala
message from: dkfjald
here are my codes...
form.php
<html> <head></head> <body> <b> <a href="main.php"><font size="4">Back To Main Page</font></a><font size="4"> </font></b> <p align="center"><b>Sending Messages To: Main Branch </b></p> <form action="confirm.php" method="post"> <p align="center"><b>Enter message:</b></p> <p align="center"><textarea name="msg" rows="5" cols="21"> </textarea></br><br> <input type="submit" name="Send" value="Send Message"><br><br> <input type="reset" value="Reset"> </p> </form> </body> </html>
confirm.php
<html>
<head>
</head>
<body>
<a href="main.php">Go back to Main</a>
<?php #MySQL-Insert-Into.php
# Copyright (c) 2007 by Dr. Herong Yang, http://www.herongyang.com/
#
$con = mysql_connect("localhost", "root", "");
$ok = mysql_select_db("message", $con);
$msg = $_POST['msg'];
$sql = "INSERT INTO inboxmain (msg)"
. " VALUES ('$msg')";
if (mysql_query($sql, $con)) {
print("Message Sent:");
} else {
print("SQL statement failed.\n");
print(mysql_errno($con).": ".mysql_error($con)."\n");
}
mysql_close($con);
?>
</body>
</html>
and see.php
<html>
<head>
</head>
<body>
<a href="main.php">Go back to main</a><br><br>
<?php #MySQL-Select-Query.php
# Copyright (c) 2007 by Dr. Herong Yang, http://www.herongyang.com/
#
$con = mysql_connect("localhost", "root", "");
$ok = mysql_select_db("message", $con);
$sql = "SELECT * FROM inboxmain ORDER BY ID DESC LIMIT 0, 10";
$res = mysql_query($sql, $con);
while ($row = mysql_fetch_array($res)) {
print("message #".$row['id']."<br>");
print(" message: ".$row['msg']."<br>");
}
mysql_free_result($res);
mysql_close($con);
?>
the output of this see.php is
number 1
message: kjsdflkjsdfkj
number 2
message: sdfsdf
and so on.... plsss help me i dont know what to do....

New Topic/Question
Reply




MultiQuote




|