Hi,
I know, I know I will feel so stupid asking....
Could someone please give me that light bulb moment? For the life of me I can't understand why this won't work...
A simple antibot verification.
Works without adding verification check..
html page:
<div style="margin-left:2px; margin-top:5px " class="onang3">your name</div>
<div style="margin-left:0px; margin-top:1px " ><input type="text" class="input" name="name" style="width:180px; height:17px; border-style:solid; border-width:1px; background-color:#000000; border-color:#BE0A0B "/></div>
<div style="margin-left:2px; margin-top:3px " class="onang3">your location</div>
<div style="margin-left:0px; margin-top:1px " ><input type="text" class="input" name="location" style="width:180px; height:17px; border-style:solid; border-width:1px; background-color:#000000; border-color:#BE0A0B " /></div>
<div style="margin-left:2px; margin-top:3px " class="onang3">your e-mail</div>
<div style="margin-left:0px; margin-top:1px " ><input type="text" class="input" name="email" style="width:180px; height:17px; border-style:solid; border-width:1px; background-color:#000000; border-color:#BE0A0B " /></div>
<div style="margin-left:2px; margin-top:3px " class="antispam1"> Leave this empty:</div>
<div style="margin-left:0px; margin-top:1px " ><input class="antispam" type="text" name="url" style="width:180px; height:17px; border-style:solid; border-width:1px; background-color:#000000; border-color:#BE0A0B " /></div>
<div style="margin-left:2px; margin-top:3px " class="onang3">your message</div>
<div style="margin-left:0px; margin-top:1px " ><input type="text" class="input" name="comment" style="width:180px; height:65px; border-style:solid; border-width:1px; background-color:#000000; border-color:#BE0A0B " /></div>
<div style="margin-left:25px; margin-top:5px; margin-right:0px" class="red">
<div align="left"><span class="red" style="margin-left:10px; margin-top:5px; margin-right:0px">
</span>
</div>
<span class="onang1">
<button type="reset" style="border: 0; background: transparent">
<img src="images/reset.jpg" alt="reset" style="margin-right:19px "/>
</button>
</span>
<span class="onang1">
<button type="submit" style="border: 0; background: transparent">
<img src="images/submit.jpg" alt="submit" />
</button>
</span>
</div>
</form>
add php page:
<?php
header("Location: guestbook.html");
if(isset($_POST['url']) && $_POST['url'] == ''){
$$dbservertype='mysql';
$servername='localhost';
$dbusername='xxxx';
$dbpassword='xxxx';
$dbname='xxxxx';
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
$name = $_POST['name'];
$email = $_POST['email'];
$location = $_POST['location'];
$comment = $_POST['comment'];
$datetime=date("d-m-y"); //date time
$rt=mysql_query("insert into guestbook(name,email,location,comment,datetime) VALUES('$name','$email','$location','$comment','$datetime')");
echo mysql_error();
}
?>
Database and all is correct, works without "if" check