Form Validaton - Mailing list pgsql-php

From Craig Main
Subject Form Validaton
Date
Msg-id 200111161222.fAGCMus16161@pygmy.inspml-sec.co.za
Whole thread Raw
List pgsql-php
Hey all,

I am having a problem intergrating a javascript validation function with the
rest of my php script. The javascript just does not seem to read the array
'samplemark' and true is returned on submitting the form. The info is
inserted into the database without any problems.  This is what I have:

snip
---------------
<script language=javascript type="text/javascript">

function samplevalidate(sample) {
 if (sample.samplemark[0].value == "") {
 alert("You must enter a Sample Mark")
 sample.samplemark[0].focus()
 return false
 }
 return true
}
</script>
-------------------------

snip
--------------------
if ($samplesubmit)
{
   $x=count($labno);
   for ($i=0;$i<$x;$i++)
      {
        echo $samplemark[$i];
        $samplesubsql="INSERT INTO tblSamples SET jobno='$njn',
labno='$labno[$i]',
        samplemark='$samplemark[$i]', comment='$comment[$i]'";

        $submitquery=mysql_query($samplesubsql) or die(mysql_error());
      }
}
------------------

snip
------------------
$seqlabno= $first_lab_no;
for ($i=0;$i<$no_of_lab_nos;$i++)
{
?>

<tr>
<td width="10%"><input type="text" size="11" name="labno[]" tabindex="-1"
value="<?=$prefix.$seqlabno?>"></td>
<td width="40%"><input type="text" size="55" name="samplemark[]"></td>
<td width="50%"><input type="text" size="65" name="comment[]"></td>
</tr>

<?
$seqlabno++;
}
-----------------------

Any help would be greatly appreciated.

Regards
Craig

--
Craig Main
IT Manager
Inspectorate M&L
Tel: (011) 763-6037
Cell: (082) 323-4670
Email: craig.main@sec.inspml.co.za


pgsql-php by date:

Previous
From: "Duncan Adams (DNS)"
Date:
Subject: Re: Re: Secure pages
Next
From: "Papp Gyozo"
Date:
Subject: Re: Re: data type casting to numbers with intval() or doubleval()