I’m trying to use a form for users to upload simple text to but am not having any luck doing so. Here is what I have so far but I do not know what’s going wrong.
First is the form…
[php]
Posting Title:
<input type="text" name="title" placeholder="Posting Title" /><br>
Location of Sale:
<input type="text" name="location" placeholder="Location of Sale" /><br>
Time of Sale:
<input type="datetime-local" name="when" placeholder="Time of Sale" /><br>
Main Items of Sale:
<input type="text" name="mainitems" placeholder="Main Items of Sale" /><br>
<input type="submit" value="Post It!"/>
</form>[/php]
next is the ‘connect.php’ file…(I have left out the information about the database information but have checked multiple times to verify that it is correct. If there is nothing wrong in the codes I have provided I will double check the database information)…
[php]$title=$_POST[‘title’];
$location=$_POST[‘location’];
$when=$_POST[‘when’];
$mainitems=$_POST[‘mainitems’];
mysql_connect($localhost,$username,$password);
mysql_select_db($database) or die( “Unable to select database”);
$sql = “INSERT INTO $table (‘title’,‘location’,‘when’,‘mainitems’) VALUES
(’’,’$title’,’$location’,’$when’,’$mainitems’)”;
$result=mysql_query($sql);
if($result){
echo "
}
else {
echo “ERROR”;
}
mysql_close();
?>
[/php]