joestar
-
Posts
3 -
Joined
-
Last visited
Posts posted by joestar
-
-
Wow talk about speed!.. thanks guys/gals, ill let you know how it worked out in a min...
-
Hey guys I am new to php and this forum. I need a little help with creating a script. the intended use is when a user visits a url like"myurl.com/?show=house" they are show a picture of housewives. Here is the code I have<?php$keyword=$_GET['show'];if (strpos($keyword,'house') !== false) { $image="housewives.jpg"; }if (strpos($keyword,'mickey') !== false) { $image="mickey.jpg"; }else { $image = "default.jpg"; }?>the issue I a having is default.jpg is always shown to the user unless the url is "myurl.com/?show=mickey"if anyone know how to solve this issue please help a noob out.
help with a simple script that switches
in PHP Coding Help
Posted · Edited by joestar
Thanks for the extended code QuickOldCar. I don't mind adding the else manually mainly because each keyword might be slightly different, for example, it might say "mickey mouse" instead of just "mickey" and I would have to create a jpg for mckey mouse and mickey. But I might be wrong as I am quite new to php.
btw the code worked a charm.