Code: Select all
function checkString($stringFieldName,$_GET){
$output="\n<p> ";
$validate=true;
if(array_key_exists($stringFieldName,$_GET))
{
//trim any whitespace from values
$string=trim($_GET[$stringFieldName]);
//check if string value is empty
if(empty($string)){
$output.="\nYou haven't entered any data in string<br />";
$validate=false;
}
if(is_numeric($string)){
$validate=false;
$output.="You have entered a number instead of text";
}
//if they have deleted values from url
}else{
$output.="\nYou have deleted the characters from the url\n";
$validate=false;
}
echo $output."\n</p>";
}Code: Select all
<?php
echo "\n<p>";
include 'validateText&Number.inc';
checkString("surname",$_GET);
if ($validate==false){
echo "\nYou did not enter the name correctly.";
}
else.etc etc etc
{Please help!! Oh I'm a php newbie btw.