submit

S

samh

I have a script as follows
<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="" />
<meta name="description" content="" />

<title>Index</title>

<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="wrapper">

<?php
include 'config.php';

$requete = "SELECT count(distinct ID) FROM comments";
$result = mysql_query ($requete,$db);
$arr = mysql_fetch_row($result);
$count = $arr[0];

$pages = (int)($count / $per_page);
if ($pages == 0) $pages=1;
else if ($count % $per_page > 0)
++$pages;

$cur_page = (int)$_GET['page'];
if (!isset($cur_page))
$cur_page = 1;

if ($cur_page < 1)
$cur_page = 1;
else if ($cur_page > $pages)
$cur_page = (int)$pages;

$requete = 'SELECT ID, name, emailurl, datetime, comment FROM comments ORDER
BY ID desc limit ' .(($cur_page-1)*$per_page) . ", $per_page";
$result = mysql_query ($requete,$db);
while($row = mysql_fetch_assoc($result)) {

$name = stripslashes($row['name']);
$emailurl = stripslashes($row['emailurl']);
$comment = stripslashes($row['comment']);
$datetime = date("n.j.y / g:ia", $row['datetime']);

}
?>

<div id="entercomment">
<form method="post" name="entercomment" action="<?=$_SERVER['PHP_SELF'] ?>">

<p align="right"><label for="name"><strong>Name</strong><br />
<input type="text" name="name" id="name" tabindex="1" size="40"
maxlength="255" dir="rtl" /></label></p>

<p align="right"><label for="emailurl"><strong> URL/Email</strong><br />
<input type="text" name="emailurl" id="emailurl" tabindex="2" size="40"
maxlength="255" dir="rtl" /></label></p>

<p align="right"><label for="comment"><strong> Comment</strong><br />
<textarea name="comment" id="comment" tabindex="3" rows="8" cols="30"
dir="rtl"></textarea></label></p>

<input type="submit" name="submit" value="ÇÑÓá" tabindex="4" style="float:
right"/> <input type="reset" name="reset" value="ãÓÍ" tabindex="5"
style="float: right" /> </p>
</form>
</div>

<div id="credits">


</div>
</div>

<?php
if(isset($_POST['submit'])) {

$name = $_POST['name'];
if ($name =="") $name = 'Anon';
$emailurl = $_POST['emailurl'];
$comment = $_POST['comment'];
if ($comment =="") $comment = 'This person was too lazy to write a
comment!';
$ip = $_SERVER["REMOTE_ADDR"];
$datetime = time();

$name = SafeAddSlashes($name);
$emailurl = SafeAddSlashes($emailurl);
$comment = SafeAddSlashes($comment);

$sql="INSERT INTO comments (name, emailurl, comment, ip, datetime) VALUES
('$name', '$emailurl', '$comment', '$ip', '$datetime')";
$result = mysql_query($sql, $db);
header("Location: http://$SERVER_NAME$REQUEST_URI");
exit;
}
?>
</body>
</html>
<? ob_end_flush(); ?>

what I need is insted of publishing the comments in the web on the spot I
need to recive it first by email then let another script to publish it in
another page but in HTM so I need some help please
Thanks in advance
 
S

samh

I have a script as follows
<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="" />
<meta name="description" content="" />

<title>Index</title>

<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="wrapper">

<?php
include 'config.php';

$requete = "SELECT count(distinct ID) FROM comments";
$result = mysql_query ($requete,$db);
$arr = mysql_fetch_row($result);
$count = $arr[0];

$pages = (int)($count / $per_page);
if ($pages == 0) $pages=1;
else if ($count % $per_page > 0)
++$pages;

$cur_page = (int)$_GET['page'];
if (!isset($cur_page))
$cur_page = 1;

if ($cur_page < 1)
$cur_page = 1;
else if ($cur_page > $pages)
$cur_page = (int)$pages;

$requete = 'SELECT ID, name, emailurl, datetime, comment FROM comments ORDER
BY ID desc limit ' .(($cur_page-1)*$per_page) . ", $per_page";
$result = mysql_query ($requete,$db);
while($row = mysql_fetch_assoc($result)) {

$name = stripslashes($row['name']);
$emailurl = stripslashes($row['emailurl']);
$comment = stripslashes($row['comment']);
$datetime = date("n.j.y / g:ia", $row['datetime']);

}
?>

<div id="entercomment">
<form method="post" name="entercomment" action="<?=$_SERVER['PHP_SELF'] ?>">

<p align="right"><label for="name"><strong>Name</strong><br />
<input type="text" name="name" id="name" tabindex="1" size="40"
maxlength="255" dir="rtl" /></label></p>

<p align="right"><label for="emailurl"><strong> URL/Email</strong><br />
<input type="text" name="emailurl" id="emailurl" tabindex="2" size="40"
maxlength="255" dir="rtl" /></label></p>

<p align="right"><label for="comment"><strong> Comment</strong><br />
<textarea name="comment" id="comment" tabindex="3" rows="8" cols="30"
dir="rtl"></textarea></label></p>

<input type="submit" name="submit" value="ÇÑÓá" tabindex="4" style="float:
right"/> <input type="reset" name="reset" value="ãÓÍ" tabindex="5"
style="float: right" /> </p>
</form>
</div>

<div id="credits">


</div>
</div>

<?php
if(isset($_POST['submit'])) {

$name = $_POST['name'];
if ($name =="") $name = 'Anon';
$emailurl = $_POST['emailurl'];
$comment = $_POST['comment'];
if ($comment =="") $comment = 'This person was too lazy to write a
comment!';
$ip = $_SERVER["REMOTE_ADDR"];
$datetime = time();

$name = SafeAddSlashes($name);
$emailurl = SafeAddSlashes($emailurl);
$comment = SafeAddSlashes($comment);

$sql="INSERT INTO comments (name, emailurl, comment, ip, datetime) VALUES
('$name', '$emailurl', '$comment', '$ip', '$datetime')";
$result = mysql_query($sql, $db);
header("Location: http://$SERVER_NAME$REQUEST_URI");
exit;
}
?>
</body>
</html>
<? ob_end_flush(); ?>

what I need is insted of publishing the comments in the web on the spot I
need to recive it first by email then let another script to publish it in
another page but in HTM so I need some help please
Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top