Syntax Errors with php-mysql and email
Posted: Thu Aug 26, 2010 2:31 pm
Hi i have been wanting to create sme coding to add some clients in to a databse and email them leting them know of the status update. the coding looks ok to me but im getin random syntax errors where they perviously wasnt. any help?
Coding here
<?php
require_once "connect_to_mysql.php";
// Tell ourselves on screen if we have connected
print "Success in database CONNECTION.....<br />";
$name = "";
$number = "";
$email = "";
$password = "";
$site = "";
$aproved = "";
if (isset ($_POST['name'])){
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$password = $_POST['password'];
$sitename = $_POST['sitename'];
if ((!$name) || (!$number) || (!$email) || (!$password) || (!$site) || (!$aproved)) {
$formMessage = "The form is incomplete, please fill in all fields.";
} else {
$sql = mysql_query("INSERT INTO users (name, number, email, password, site, aproved)
VALUES('$name','$number','$email','$password','$site','$aproved')")
or die (mysql_error());
$to = "$email1, admin@anydaywebhosting";
$from = "yourfreesite@anydaywebhosting.com";
$subject = "Status Update";
//Begin HTML Email Message
$message = "Hi $name,
I am emailing you on update the status of your Free Site. $aproved
If your attempt was sucsessful you will now be able to go about creating your site. Your Details are..
FTP Username: $site
FTP Password: $password
To log to: ftp.anydaywebhosting.com with your details.
If you do on have a program to design your website you can see a list from our directory at directory.anydaywebhosting.com/webdesign.php or reply to this email for more information
If for any reason you should need your password/login name changing or if you had problems creating your site please reply to this email quoting your current site and password. If you dont have accses to these please state any other information you can give to help speed the process along.
See you on the site!
Admin@anydaywebhosting";
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
}
?>
<form id="form1" name="form1" method="post" action="newuser.php">
<p><?php print $formsite; ?> <br />
<br />
Your Name:<br />
<input name="name" type="text" id="name" size="36" maxlength="32" value="<?php print $name; ?>" />
</p>
<p>Your Phone Number<br />
<input name="number" type="text" id="number" size="36" maxlength="32" value="<?php print $number; ?>" />
<br />
<br />
Your Email: <br />
<input name="email" type="text" id="email" size="36" maxlength="32" value="<?php print $email; ?>" />
<br />
</p>
<p>Your Password <br />
<input name="password" type="text" id="password" size="36" maxlength="32" value="<?php print $password; ?>" />
<br />
<br />
Choose your website name<br />
<input name="site" type="text" id="site" size="36" maxlength="32" value="<?php print $site; ?>" />
</p>
<p><br />
aproved?comment<br />
<input name="aproved" type="text" id="aproved" size="36" maxlength="225" value="<?php print $aproved; ?>" />
</p>
<p>(You will log in with your site name)<br />
<br />
<input type="submit" name="button" id="button" value="Send Now" />
</p>
</form>
</p></td>
</tr>
</table>
Coding here
<?php
require_once "connect_to_mysql.php";
// Tell ourselves on screen if we have connected
print "Success in database CONNECTION.....<br />";
$name = "";
$number = "";
$email = "";
$password = "";
$site = "";
$aproved = "";
if (isset ($_POST['name'])){
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$password = $_POST['password'];
$sitename = $_POST['sitename'];
if ((!$name) || (!$number) || (!$email) || (!$password) || (!$site) || (!$aproved)) {
$formMessage = "The form is incomplete, please fill in all fields.";
} else {
$sql = mysql_query("INSERT INTO users (name, number, email, password, site, aproved)
VALUES('$name','$number','$email','$password','$site','$aproved')")
or die (mysql_error());
$to = "$email1, admin@anydaywebhosting";
$from = "yourfreesite@anydaywebhosting.com";
$subject = "Status Update";
//Begin HTML Email Message
$message = "Hi $name,
I am emailing you on update the status of your Free Site. $aproved
If your attempt was sucsessful you will now be able to go about creating your site. Your Details are..
FTP Username: $site
FTP Password: $password
To log to: ftp.anydaywebhosting.com with your details.
If you do on have a program to design your website you can see a list from our directory at directory.anydaywebhosting.com/webdesign.php or reply to this email for more information
If for any reason you should need your password/login name changing or if you had problems creating your site please reply to this email quoting your current site and password. If you dont have accses to these please state any other information you can give to help speed the process along.
See you on the site!
Admin@anydaywebhosting";
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
}
?>
<form id="form1" name="form1" method="post" action="newuser.php">
<p><?php print $formsite; ?> <br />
<br />
Your Name:<br />
<input name="name" type="text" id="name" size="36" maxlength="32" value="<?php print $name; ?>" />
</p>
<p>Your Phone Number<br />
<input name="number" type="text" id="number" size="36" maxlength="32" value="<?php print $number; ?>" />
<br />
<br />
Your Email: <br />
<input name="email" type="text" id="email" size="36" maxlength="32" value="<?php print $email; ?>" />
<br />
</p>
<p>Your Password <br />
<input name="password" type="text" id="password" size="36" maxlength="32" value="<?php print $password; ?>" />
<br />
<br />
Choose your website name<br />
<input name="site" type="text" id="site" size="36" maxlength="32" value="<?php print $site; ?>" />
</p>
<p><br />
aproved?comment<br />
<input name="aproved" type="text" id="aproved" size="36" maxlength="225" value="<?php print $aproved; ?>" />
</p>
<p>(You will log in with your site name)<br />
<br />
<input type="submit" name="button" id="button" value="Send Now" />
</p>
</form>
</p></td>
</tr>
</table>