No access when $_post

General Chat, Comments
Post Reply
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

No access when $_post

Post 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"]);
}
?>
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: No access when $_post

Post 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">
Creator of Dot World Maker
Mad programmer and annoying composer
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: No access when $_post

Post by KaL »

thank you!
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: No access when $_post

Post by a_bertrand »

You should really really start to read the existing code. All that is already multiple times in existing modules.
Creator of Dot World Maker
Mad programmer and annoying composer
Post Reply

Return to “General”