hello all, i have been working on an ecard script using mysql, php for the last several months...and i'm almost there
BUT i am having problems with getting variables from a forum to store in a table, that tries to be created, everytime the person submits their card. After the variables are stored i then have an email sent to the personw with a corresponding link(have not tried to get the informaiton to be outputted yet...because i can't get variables to be stored). here is my code for both pages, i appreciate anyhelp that anyone can give. i am very newb because i've picked up all the basics while trying to dot his project, but i stll have problems with the database end. You will notice in the code there is a session (image) that is because i am trying to create images that are hyperlinks to an "image" id, and therefor whatever image the person clicks on, would be displayed on that card, help with that is alos needed. thanks
index page
<html>
<head>
<title>PHPpostcard by - WWW Design</title>
<style type="text/css">
</style>
</head>
<body bgcolor="#999999" text="#000000" link="#000000" vlink="#000000" alink="#FFFFFF" >
<div align="center"><br><br><br><br><br>
<table style="border: 1px solid black" style="background: url(images/postcard.jpg)" style="color: #000000" width="660px" height="350px" cellspacing="0" cellpadding="2">
<tr>
<td name="image" width="26%" rowspan="3">
<table name="image" valign="top">
<tr>
<td name="spacer"></td><td valign="top"><IMG SRC="images/winter.jpg"></td>
</tr>
</table>
</td>
<tr>
<form method="get" action="send.php">
<td name="information" width="175px"><div align="right"><br>
<input type="text" style="border: 0px solid black" style="font-size: 10" name="to" style="background: transparent" height="10px">
<?escapeshellcmd($to);?>
<br><br>
<input type="text" style="border: 0px solid black" style="font-size: 10" name="from" style="background: transparent">
<?escapeshellcmd($from);?>
<br><br>
<input type="text" style="border: 0px solid black" style="font-size: 10" name="email" style="background: transparent">
<?escapeshellcmd($email);?>
</td>
</tr>
<tr>
<td name="from" width="" height="20px" colspan="2" valign="bottom">
<br>
<div align="right"><input type="submit" value="Send!" style="border: 1px solid black" style="font-size: 10">
<input type="reset" value="Clear!" style="border: 1px solid black" style="font-size: 10">
</form>
</td>
</tr>
</table>
</body>
</html>
-----------------------------------------
MySQL Part
<?
session_start();
include("dbconnect.php");
function CreateID($length=16){
$Pool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$Pool .= "1234567890floppydogs";
for($index = 0; $index < $length; $index++){
$sid .= substr($Pool,(rand()%(strlen($Pool))), 1);
}
return($sid);
}
$sid=CreateID();
$result = mysql_query("INSERT INTO information VALUES('$sid', '$to', '$from', '$email')");
if(!$result){
$sid=CreateID();
$result = mysql_query("INSERT INTO information VALUES('$sid', '$to', '$from', '$email')");
}
$mailTo = "$email";
$mailSubject = "You an ecard from WWW Design!";
$mailHeader = "From: $from";
$message = "Hello $to, $from has sent u an Ecard. You can view this card at the following webpage: ";
$message .= "http://maverick.sifen7.com/card/viewcard.php?ID=";
$message .= $sid;
mail($mailTo, $mailSubject, $message, $mailHeader);
$query = "SELECT * FROM information";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo "To: $row[to]<br />";
echo "From: $row[from]<br />";
echo "Email: $row[email]<br />";
session_destroy();
?>