Inserting help
Posted: Mon Jun 06, 2005 11:13 am
For some reason this script will only send blanks to MySQL why is it sending blanks??
thank you
Smackie
Code: Select all
<?php
if(isset($_POST['post'])) {
$site_name = $_POST['site_name'];
$tablecolor = $_POST['tablecolor'];
$background = $_POST['background'];
}
$sql = "INSERT INTO sitestuff (site_name, tablecolor, background) VALUES ('$site_name', '$tablecolor', '$background')";
echo '<form name="form" method="post" action="../install.php?pages=site-stuff">';
echo 'Site Name:<input name="$site_name" type="text" size="35" maxlength="100"><br>';
echo 'Table Color:<input name="$tablecolor" type="text" size="35" maxlength="100"> <font color="red">*Please add # before the numbers or just use red, blue ect.*</font><br>';
echo 'Background Color:<input name="$background" type="text" size="35" maxlength="100"> <font color="red">*Please add # before the numbers or just use red, blue ect.*</font><br>';
echo '<input type="submit" name="Submit" value="Submit"></form>';
$result = mysql_query($sql);
if (!$result) {
echo '<b>Error!</b> Please contact the administrator.';
} else {
echo 'Tables were successfully added.';
}
?>Smackie