Page 1 of 1
validate filter
Posted: Sat May 02, 2009 3:23 pm
by jd57
Can someone tell me why the filter $PodName does not work, what wrong with this code?
Code: Select all
if($num > 0){
$name_exist = "<font size=5>$BloomName is a Registered Cultivar. Please Rename your Cultivar.</font>";
echo $name_exist;
exit;
} else {
$name_ok = "<font size=5>$BloomName is not a Registered Cultivar. You may register as $BloomName.</font>";
}
if($num > 0){
$pod_exist = "$PodName";
exit;
} else {
$pod_reg = $PodName . '[Not Registered]';
}
Re: validate filter
Posted: Sat May 02, 2009 11:07 pm
by JAB Creations
You seem to have a few things confused so let me help you sort it out...
Code: Select all
$y1 = 'text';
$hello1 = '$y1';
$hello2 = "$y1";
echo '<div>'.$hello1.'</div>'."\n";//outputs '$y1'
echo '<div>'.$hello2.'</div>'."\n";//outputs 'text'
Single and double quotes act differently in PHP.
Also
never use the font element, it's been long deprecated, you should use the span element instead.
Code: Select all
<span class="size17">example text</span>
Look more up about CSS while you're at it. Once you learn that you'll realize how you just can't live without it if you're going to even be half serious about coding.

Re: validate filter
Posted: Sun May 03, 2009 3:21 am
by jd57
Hi
I think I made the right corrections to the code, but it does'nt work the way it should. I would like $PodName keeps the same if data is found in the database, or else add [Not Registered] to the name.
Code: Select all
if($num > 0){
$name_exist = "<font size=5>$BloomName is a Registered Cultivar. Please Rename your Cultivar.</font>";
echo $name_exist;
exit;
} else {
$name_ok = "<font size=5>$BloomName is not a Registered Cultivar. You may register as $BloomName.</font>";
}
if($num > 0){
$pod_exist = '$PodName';
exit;
} else {
$pod_reg = "$PodName [Not Registered]";
}
Re: validate filter
Posted: Sun May 03, 2009 2:14 pm
by McInfo
JAB Creations wrote:Code: Select all
<span class="size17">example text</span>
Correction:
Edit: This post was recovered from search engine cache.
Re: validate filter
Posted: Sun May 03, 2009 2:25 pm
by McInfo
jd57 wrote:I think I made the right corrections to the code, but it does'nt work the way it should.
There is not enough code there to make a conclusive determination about what is wrong. I think you are probably using too many variables, which is confusing you about what any of them hold. Also, on line 9, $pod_exist is assigned a string, but it is never used because the script terminates on the next line.
Edit: This post was recovered from search engine cache.