Page 1 of 1

No access when $_post

Posted: Fri Jan 31, 2014 6:43 pm
by KaL
A little help here. i'm trying to insert player input data into the database but i keep on getting "No Access"

<?php



TableHeader("Shop");
echo "<form action='modules/companiesowner/content.php' method='post' name='first'>";
echo "<td>Name:<input type='text' name='CompName' value=''>";
echo "<td>Number:<input type='int' name='Wages' value=''>";


TableFooter();

ButtonArea();
SubmitButton('Submit', 'first');
LinkButton('Cancel', 'index.php?p=companiesowner');
EndButtonArea();

if (isset($_POST['first']))
{
$db->Execute("insert into company_owner(CompName,Wages) values(?,?)", $_POST["CompName"], $_POST["Wages"]);
}
?>

Re: No access when $_post

Posted: Fri Jan 31, 2014 7:33 pm
by a_bertrand
Because you must always call the index.php not directly the module file "modules/companiesowner/content.php" !

so your form must be:
<form method="post"> (as the url in the action will be kept for you)
or if you really want to (and I would avoid it)
<form method="post" action="index.php?p=companiesowner">

Re: No access when $_post

Posted: Sat Feb 01, 2014 2:42 pm
by KaL
thank you!

Re: No access when $_post

Posted: Sat Feb 01, 2014 6:36 pm
by a_bertrand
You should really really start to read the existing code. All that is already multiple times in existing modules.