On Monday 25 December 2006 13:35, Geert T wrote:
> Hi,
>
> I have made some script that process the users input, and validates the
> input and sends it back. But it doesn't work very well, in fact it doesn't
> work at all. I am only able to see and input my name and such in the html
> form, but the php part doesn't do it's job. I have looked over the scripts
> thousands of times, but couldn't find the problem, really.
>
> Here is the script plus 2 .inc files;
>
> Hoping for some replies and answers,
> Thanks in advance!
>
> PS: if this script is a bit messy to read, I have included them in this
> mail seperately.
>
I cannot get 3rd script. And this one may solve your problem in address form
and info.inc..
<?php
$labels = array( "firstName"=> "First Name:",
"midName"=>"Middle Name:",
"lastName"=>"Last Name:",
"street"=>"Street Address:",
"city"=>"City:",
"state"=>"State:",
"zipcode"=>"Zipcode:");
$strLoop = '';
$intSize = sizeof($labels);
$arrKeys = arrayKeys($labels);
for($l=0;$l<$intSize;$l++)
{
$value = '';
if(isset($_REQUEST[$labels[$arrKeys[$l]]]))
{
$value = $_REQUEST[$labels[$arrKeys[$l]]];
}
$strLoop.=
" <tr>
<td align='right'>
".$labels[$arrKeys[$l]]."<br/>
</td>
<td>
<input type='text'
name='".$arrKeys[$l]."' size='65' maxlength='65'
value='".$value."' />
</td>
</tr>\n";
}
$strPage =
"<html>
<head>
<title>
Customer Address
</title>
</head>
<body>
<p align='center'>
<form action='validateForm.php' method='POST'>
<table width='95%' border='0' cellspacing='0'
cellpadding='2'>
".$strLoop."
<tr>
<td align='center'>
<input type='Submit' name='Submit'
value='Submit Address' />
</td>
</tr>
</table>
</form>
</p>
</body>
</html>\n";
echo $strPage;
?>
validateForm.php
May Look like this
<?php
$intSize = sizeof($_REQUEST);
$arrKeys = array_keys($_REQUEST)
// Or you may use $labels array again
if($intSize > 0)
{
for($r=0;$r<$intSize;$r++)
{
// do some global check for all $_REQUEST elements
// then do some conditional
switch ($_REQUEST[$arrKeys[$r]])
{
case "firstName":
//do Someting
break;
....
}
}
}
?>
Regards
Sancar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php