Ok I'm having some troubles and I'm sure I'm doing something stupid ok basic form processing As I see it. I'm using phpnuke and this is the basic form layout
echo "<FORM ACTION='modules.php?name=$module_name' method=POST>";
.....form stuff
... then the submit and reset buttons
echo "<input type='hidden' name='action' value='submit'>";
echo "<TR><TD><INPUT type = 'submit' value = 'Submit' onclick = 'return FormDataTest()' ></TD>";
echo "<TD><INPUT type = 'reset' value = 'Reset'></TD></TR>";
#----------------------------------------------------------------------------------------
function FormDataTest()
{
$Errors = Array();
$SubmitFail = true;
if (CheckNum($POST['AprtSize'],'F')== true)
{
$Errors[]= 'Please enter a valid Apartment Size';
$SubmitFail = false;
}
if (CheckNum($POST['AprtRooms'],'F')== true)
{
$Errors[]= 'Please enter a valid Number of Rooms';
$SubmitFail = false;
}
if (CheckNum($POST['RENT'],'F')== true)
{
$Errors[]= 'Please enter a valid Rent amount';
$SubmitFail = false;
}
if (CheckNum($POST['FindersFee'],'F')== true)
{
$Errors[]= 'Please enter a valid Finders fee amount ';
$SubmitFail = false;
}
if (CheckNum($POST['Invest'],'F')== true)
{
$Errors[]= 'Please enter a valid Invest amount';
$SubmitFail = false;
}
if (CheckNum($POST['Deposit'],'F')== true)
{
$Errors[]= 'Please enter a valid Deposit amount';
$SubmitFail = false;
}
if (CheckDistrict()== true)
{
$Errors[]= 'Please Select a District';
$SubmitFail = false;
}
DisplayAlert($Errors);
return $SubmitFail;
}
function DisplayAlert($Errors)
{
?>
<script><!--
alert("hello");
--></script>
<?php ;
}
Ok This all kind of works except that the alert is displayed to late.
the page has allready started updating when the alert is displayed. I think I need to hold the page until the onclick command returns but i have no idea how. Have look is you have any comments please please post them any thing would help