I have this piece of code:
function whatever() { // Test
global $userrow, $numqueries;
if (isset($_POST["submit"])) {
if ($userrow["level"] < 5) { display("Do not meet requirement<br /><br />You may return to <a href=\"index.php\">town</a>, or use the compass to start exploring.","You do not meet the level requirement."); die(); }
$title = "Title here, second page.";
$query = doquery("UPDATE {{table}} SET updatesomethingplanned='towhatever', WHERE id='".$userrow["id"]."' LIMIT 1", "users");
$page = "Text here for second page<br /><br />You may return to <a href=\"index.php\">town</a>, or use the compass to start exploring.";
} elseif (isset($_POST["cancel"])) {
header("Location: index.php"); die();
} else {
$title = "Title here";
$page = "Text Here.<br /><br />\n";
$page .= "Text here<br /><br />\n";
$page .= "<form action=\"index.php?do=titles1\" method=\"post\">\n";
$page .= "<input type=\"submit\" name=\"submit\" value=\"Ok\" /> <input type=\"submit\" name=\"cancel\" value=\"No Thanks\" />\n";
$page .= "</form>\n";
$page .= "You may return to <a href=\"index.php\">town</a>, or use the compass to start exploring.<br /><br />\n";
}
display($page, $title);
}
I want to add a text field so users can type in what they want to type.
I know i use something like this:
$query = doquery("UPDATE {{table}} SET charname='".$_POST["charname"]."' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
But, i dont know how to add it to the code above, and have a text field in it which links to this too, i cant get it to work.
I hope this makes sense, but the whole idea of it is to update a persons character name in the database
Thanks for any help!