From: Craig Main <craig.main@sec.inspml.co.za>
To: pgsql-php@postgresql.org
Subject: Form Validaton
Date: Fri, 16 Nov 2001 14:18:44 +0200
Message-ID: <200111161222.fAGCMus16161@pygmy.inspml-sec.co.za> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: craig.main@sec.inspml.co.za
Subject: Re: Form Validaton
In-Reply-To: <200111161222.fAGCMus16161@pygmy.inspml-sec.co.za>
References: <200111161222.fAGCMus16161@pygmy.inspml-sec.co.za>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox