PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hello,
I am very new to PHP and do not know MySQL, so I am trying to make a mini-search engine with just PHP. I have two questions, but first here is my code:
<?php
if ($_POSTї'search']=='computer' OR $_POSTї'search']=='repair') {
print ("<A HREF=/repair.html>IT Worked with computer repair</A>");
}
?>
<?php
if ($_POSTї'search']=="sales" OR $_POSTї'search']=='computer'){
print ("<A HREF=/repair.html>IT Worked with computer sales</A>");
}
?>
<?php
if ($_POSTї'search']=='web' or $_POSTї'search']=='design'){
print ("<A HREF=/repair.html>IT Worked with web design</A>");
}
?>
<?php
if ($_POSTї'search']=='hosting' or $_POSTї'search']=='web'){
print ("<A HREF=/repair.html>IT Worked with web hosting</A>");
}
?>
How do I make it so everything is not case sensitive. For example, currently if I search on my site for "Web", i will not get any results, but if i use "web" I will. Also is there an easier way of combining the two OR statements in each of the IF statements?
Thanks
Ryan RySk8er30@Aol.com
To save typing everything in uppercase it may be easier to use strtolower() instead of strtoupper(). That way everything will be lowercase and you can leave your conditions as they were.