I know the question is a little bit outdated but....
Your form will run only once... or everytime... depending on how you load the page. If the form submits POST, unsetting is kind of sinceless. Let´s say the form on the top says:
Push button and submit "hello world". You push the button, page get´s load (and since you dont use ajax, it has to load new)
, "hello world" is submitted and after submit POST get´s unset. Form is still there.. you press button again... same thing happens again. To avoid this you propably have to use $_SESSION
Sample
if((!isset($_SESSION['arrowsWasSet']))
{
if(isset($_POST['arrow1']) and isset($_POST['arrow2']))
{
unset($_POST);
$_SESSION['arrowWasSet'] = true;
}
}
other way is to store data into the session and check if its already set to session.
if(isset($_POST['arrow1']) && isset($_POST['arrow2']))
{
if(!isset($_SESSION['arrows']))
{
$_SESSION['arrows']['arrow1'] = $_POST['arrow1'];
$_SESSION['arrows']['arrow2'] = $_POST['arrow2'];
}
unset($_POST);
//you can call this to get a clean post everytime, but no need.
}
do you have a type in there ? i mean shouldnt this mean array1
instead of arrow1
? :)
anyways, $_SESSION
survives the refresh. So after refreshing the page, you can still check if something happend. To empty session you could do:
-
session_destroy (kills hole session)
-
restart your Browser (not refresh, totaly restart! kills hole session)
-
hitting keys
ALT
+ F5
(kills hole session)
-
clear Browsercache manualy (kills hole session)
-
$_SESSION['xy'] = NULL;
(kills parts in session)
-
unset($_SESSION['xy']);
(kills parts in session)