PDA

View Full Version : help with PHP -- this should be easy


mcovey
July 31st, 2004, 11:09 AM
<?php
if (strpos($_SERVER['HTTP_REFERER'], 'test.php') !== FALSE ) {
if (strpos($_POST['foo'], 'bar') !== FALSE) {
echo "<h1>'bar' is correct!</h1>"; }
elseif (strpos($_POST['foo'], '$ar') !== FALSE) {
echo "<h1>";
echo $_POST['foo'];
echo " rhymes with the right word, at least </h1>"; }
else {
echo "<h1>";
echo $_POST['foo'];
echo " is WRONG</h1>"; }

} else { }

?>


a nice small script to respond to the input of a form, and I need to make this happen:

when someone inputs anything that rhymes with bar, like car or star, it will say "well X rhymes." It seems easy, and i know it's not foolproof (like if they put war), but it's my second day of PHP.

oh by the way if anyone wants to see the form/page, go to http://metawire.org/~mcovey/test.php