Form Validaton

From: Craig Main <craig(dot)main(at)sec(dot)inspml(dot)co(dot)za>
To: pgsql-php(at)postgresql(dot)org
Subject: Form Validaton
Date: 2001-11-16 12:18:44
Message-ID: 200111161222.fAGCMus16161@pygmy.inspml-sec.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)main(at)sec(dot)inspml(dot)co(dot)za

Browse pgsql-php by date

  From Date Subject
Next Message Vince Vielhaber 2001-11-16 15:47:25 Re: Re: Secure pages
Previous Message Andrew McMillan 2001-11-16 10:26:20 Re: HTTP authentication