I've been hired to create a basic advertising system for a website. Here is what I've got so far...
http://namcocentral.com/add-advert.php
<html>
<head></head>
<body>
<?php
//This establishes database connection
mysql_connect ("localhost", "xxxx", "xxxx") or die ('Error connecting to mysql');
mysql_select_db ("xxxx");
//This adds database row when upload ad is selected
if(isset($_POST['submit']))
{
$URL = $_POST['URL'];
$Image = $_POST['Image'];
$Impressions = $_POST['Impressions'];
$query="INSERT INTO test_ads (ID, URL, Image, Impressions)VALUES ('NULL','".£URL."','".£Image."','".£Impressions."')";
mysql_query($query) or die ('Error updating database');
echo "New advert added";
}
else
{
}
?>
<h1>Add Advertisement</h1>
<form method="post">
<h2>URL</h2>
<input type="text" name="URL" size="50" /><br />
<h2>Image</h2>
<input type="text" name="Image" size="50" /><br />
<h2>Number of Impressions</h2>
<input type="text" name="Impressions" size="12" /><br />
<h2>Submit</h2>
<input id="submit" type="submit" value="Update Database" /></form>
</body>
</html>
The problem is that when I try to submit the data, it doesn't work. Does anyone more experience know where I've gone wrong? Thanks 🙂