tomms Posted January 10, 2007 Share Posted January 10, 2007 hey people, happy new yearsim kinda new in php and am trying to write a script that will allow me to replace text with a image.I have a listings page and when a user performs a search i would like any instance of "yes" to be replaced by a checkmark image, and any "no" with a x image.any help would be greatly appreicated Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 str_replace() ?If you post some sample code we can help better. Quote Link to comment Share on other sites More sharing options...
tomms Posted January 10, 2007 Author Share Posted January 10, 2007 sample code?what i want to do is replace any intace of "yes" withcheckmark.jpgand any instance of "no" withxx.jpgon a given page Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted January 10, 2007 Share Posted January 10, 2007 what she's asking is to see the source for the site, we cant tell you more than str_replace() until you show us your source and let us show you how to use it...for instance if you wanted to get all the contents of google.com and replace every instance of "web" with "cake" (because cake is just as good as the web, dont kid yourself) you would do...[code=php:0]<?php$contents = file_get_contents('http://www.google.com/');$contents = str_replace('Web', 'Cake', $contents);?>[/code]other than telling you this completely worthless information I would be able to help you incorporate it into your site ;) Quote Link to comment Share on other sites More sharing options...
tomms Posted January 10, 2007 Author Share Posted January 10, 2007 ok im a noob, so maybe im not getting itsay i have html page with a bunch of "yes" and "no" on it, how would i convert those yes and no's to images using php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.