Right but how does the form know that? Should I just insert that while I'm inserting the form values? I don't get how that knows that that form was submitted by that user. Anyone can explain please??
This is my form:
HTML Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<div id="usercp_content">
{vb:raw oftw_sidemenu}
<div class="cp_content" style="width: 80%; float: right;">
<h2 class="blockhead">Contests Of The Week</h2>
<div class="blocksubhead">
<center><form action="nominate.php" method="post">
Enter Image URL to Nominate: <input type="text" name="imgurl"><input type="submit" name="submit">
</form>
</center>
</div>
{vb:raw print_nominations}
</div>
</div>
{vb:raw footer}
</body>
</html>
This processes the form:
PHP Code:
<?php
require_once('./global.php');
define('CSRF_PROTECTION', true);
if (!isset($_POST['submit'])) {
}
else {
$imgurl = empty($_POST['imgurl']) ? die ("ERROR: Enter a imgurl") : mysql_escape_string($_POST['imgurl']);
// create query
$db->query_write("INSERT INTO oftw_nominations (imgurl) VALUES ('$imgurl')");
header( "refresh:0; url=http://development.aniworlds.net/oftw_nominations.php" );
// close connection
mysql_close($connection);
}
?>
Any ideas how I can also insert the username of whoever submitted this form?