Highlight Dynamically Generated Text
I have a search form which makes queries to a database. In the form the user can search for many words (word1 && word2 && word3). I want in the results to highlight the words that the user has searched for. I 've searched in the internet and i've found some codes but none of them works with all the possible results.
What I have found so far which is closer to what I want is the following:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamically Generated Results Table
I'm trying to write a script that dynamically generates HTML tables depending on the results from an SQL query. So far, I have managed to set the HTML table headers to be the same as those in the MySQL table. [thanks to rod k -cheers !] Now i'm trying to put the results in the table. Basically, I need a MySQL function to retrieve data and put it into the table until there is no data left.... (At the moment I am using "mysql_fetch_array()", but with this it is necessary to know the names of the columns to retrieve the information for each result set. Since my table is dynamic and should be able to build itself from different MySQL tables, the column names aren't fixed and so i can't use this to put the data in the tables...)
Populating Dynamically Generated TextFields
If one assigns something to the value iattribute off an input /text field, that value will be displayed when the form is loaded. My problem is, when building a form dynamically, the only way I can get the text to show is by doing the above, however, as this is an update form, when the form POSTS to processUpdate.php, both the data entered by the user AND the data in the value attribute are inserted/updated. So, how does one dynamically build a form where the data is displayed in the text fields but value atttribute is not set. PHP Code:
Uploading A Dynamically-generated Image
I have a script that generates an image based on users' inputs. How would I make it so that the script automatically uploads that image to a different folder on the server? I'm stumped on this one. Does anybody have any ideas?
Dynamically Generated Form And Update Problems
In brief, in the following 2 portions of code I build a form based on data retrieved from a database. The second bit of code receives the posted data for processing and updating the database. Problem is that the update occurs for the first row of data but none of the rest. I'm using a hidden field, written in dynamically ( name="tfHiddenId<?php echo $j ?>" ) where $j is a counter var in a loop. When I print out the POST_VARS everything is as I want to be, fields all named according ly, as above. Just the update either 1) only does one row and quits or 2) updates same row with the same data over and over ( I suspect the latter ). Apparently my counter variable is not being incremented, but only on one var, "tfHiddenId".$i , on the receiving page. Here's the code for where the form is built from the DB: PHP Code:
Use Strcmp To Edit A Dynamically Generated Dropdown...
I've written a code that runs a 'SHOW DATABASES' query on my mysql server and lists the results(the names of the databases on my server) in a dynamically generated dropdown box, and it works just fine, using the following code: echo "<select name='databaseselect'>"; $dblist = mysql_query('SHOW DATABASES'); while ($row = mysql_fetch_row($dblist)) { echo "<option value='$row2[0]'>$row2[0]</option>"; } echo "</select>"; The problem is that it lists ALL of the databases on my server - that's two of my own user-created databases, and the two default databases that come with the mysql server - 'information_schema' and 'mysql'. What I want to do is to, after running the 'SHOW DATABASES' query, eliminate those two databases from appearing in the dropdown box, because I don't want anyone to see them, as they're useless to anybody else. Code:
Multiple Submit Buttons In Dynamically Generated Form
I have one big form on a page, within which is a list of text fields pulled from a mysql db. Each text field has an 'update' button, which submits the main form, and should UPDATE the textfield it relates to. The problem is, all the buttons have value="Update" and I can't think of an efficient way of passing the unique id of each record to be submitted with it. Obviously, having a hidden field for each textfield won't work because the form will use the last one displayed.
Uploading Generated Text Fields
I have on a page 4 text fields shown for a user to enter an amount in. If they have more than 4 amounts to enter in i have a button which, when clicked adds another text field although the max amount of text fields avaliable is 15. I need my php script to take the values entered by the user and send them into my MS Access database and order them into one field within the table with each value separated my commas. I have included this post my php so far, and the javascript code which generates the text fields which are unique in name. Code:
Sizing A Text Area Dynamically
I have several text areas I am putting information from MySQL into. Right now they are 50 characters wide, by 10 rows. I want the number of rows to dynamically size do that the text area is the same size as the length of the data in MySQL. I've tried all the logic I can think of... taking strlen and dividing it by the width... works great until they use line feeds... if someone puts: "Hello... thanks." the character count divided by the width is off. Here is the code I am using: Code:
Plot Graphic Lines And Text Dynamically
I'm looking for a method to plot graphic lines and text for a bracket-like display with multiple tiers in a browser. I'm familiar with GD for outputting dynamic graphics, but have never utilized its native drawing capabilities. Is it well-suited for this task? Any better alternatives?
Centering Text In A Dynamically Created Image
These are live stats from my forum, taken from my database. As you can see, it looks ok, as long as the values are pretty uniform, but when I get a board style that is only three characters long like this one: Then It starts to look weird, does anyone know how I can center the text and the avatar within a certain area? The max size for a username is 18 characters, the max length for theme is 11 characters, the shortest is 3, the post count, join date, and last visit date still need to be centered, but length doesn't really matter with those. Also, the max size for the avatars are 100x100, the minimum is anything less than that. I know I could get the width of the picture and do some math to figure out where to put it, right now, at full size, the x and y coordinates of the picture are: (45, 48), so that would be the maximum, but I can't figure out how I would calculate the location for things smaller than that.
Dynamically Genetrate RAM (Real Media) Text Files
I am working on a record company's site. They offer a selection of track snippets for stream/download. I would like to be able to dynamically generate the RAM (text File) to save manual input in the DB. Currently each RAM file has to be uploaded everytime a new track is added....but I'd like to have this created on the fly when a user is browsing the site. user selects track...is forwarded to the dynamically generated RAM file...which in turn selects the appropriate media. I can't think how i'd get this to work as I am trying to create a text file that is parsed rather than a peice of HTML that is read by a user. Perhaps on the server I'd have to add PHP Parsing to the RAM mime type?
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
How To Highlight Cell
I have a table with 12 cols and 10 rows. When a user clicks on a table cell; the page is refreshed and displays some data below the table dependant on whichever cell was selected. I would like to make it so that whichever cell was clicked; the background color is changed - so that when the user sees the data, (s)he can tell which cell it relates to. Does anyone know of a clever way to do this ? I'm afraid my creativity is running a bit dry on this one as the only working way i could come up with so far is to have an if statement before each table cell is created, which is long winded.
List Box Highlight Id?
i am just trying highlight one of title in my select list box, when $dlist['id'] = $selvalue; so far my select highlights the first option. $selvalue = $_GET['id']; $outdata= "<select name="titles" >"; $outdata.="<option value=''> Please choose the Title</option>"; while( $dlist = mysql_fetch_array($result) ) $outdata.="<option value='".$dlist['id']. "'> " .$dlist['serial_number']. "-" .$dlist['title']. " </option>"; $outdata.="</select>";
Code Highlight For UltraDev 4
I have seen the method for making UltraDev 4 highlight the PHP code on the net but can't remember. Does someone know how or where I can find the method to do so.
How To Highlight Search Terms
Commonly done, eg. you enter a word in a search engine and when a hit-page comes up the search word(s) are highlighted. I'm doing a fulltext search that works well but I've tried a few "packaged scripts" and haven't got one to work yet. I'm looking for straightforward understandable way to do this on my MYSQL/PHP pages.
Highlight Code/syntax?
I've seen this on many sites, including this one. Where you have a code (say, PHP), and different commands and functions are coloured in different ways. An example: <?php echo 'text'; ?> Various colours are used to highlight different parts of the code. I've tried google'ing it, but I found nothing. Anyone know how to do it?
Problem Adding A Highlight With Imagecopymerge
I'm trying to use the PHP GD functions to make graphical changes to image files. In particular I'm trying to add a 'highlight' rectangle to an image. So far everything I've tried doesn't work as I'd expect. The best I've got is to make a copy of the rectangle and imagecopymerge() it back onto the original with a 'pct' value. This creates a visible region, but it isn't highlighted, it's always darker. Here is my code for this: function highlightSpot($image, $id, $posx, $posy) { global $spots; global $offset; // get coords of the box to highlight based on $id $box = spotLegend($image, $id, $posx, $posy); // get the spot information $spot = $spots[$id]; // get color index of existing map pixel // highlight the spot on the map $rectImage = imagecreatetruecolor($spot[3] - $spot[1], $spot[4] - $spot[2]); $setpixel = imagesetpixel($image, 0, 0, imagecolorallocate($rectImage, 0, 0, 0)); $index = imagecolorat($image, $spot[1], $spot[2] + $offset); $rgb = imagecolorsforindex($rectImage, $index); $color = imagecolorallocate($rectImage, $rgb["red"], $rgb["green"], $rgb["blue"]); // copy section of image to new image imagecopy($rectImage, $image, 0, 0, $spot[1], $spot[2] + $offset, imageSX($rectImage), imageSY($rectImage)); // merge highlight onto map imagecopymerge($image, $rectImage, $spot[1], $spot[2] + $offset, 0, 0, imageSX($rectImage), imageSY($rectImage), 80); imagerectangle($image, $spot[1], $spot[2] + $offset, $spot[3], $spot[4] + $offset, imagecolorallocate($image, 0, 0, 0)); // clean up imagedestroy($rectImage); } What I'd really like is to create a highlighted rectangle in yellow, like someone drew on the image with a 'highlighter'.
Highlight Search Terms In Results Pages
I am trying to find a script or code that will highlight search terms output from my MySql db. I have posted a portion of my pagination page below. The pagination script provides ten records at a time. For example, I need code, a script, or a funtion to grab the search term coming from the user and generate highlighted keywords when the keywords are entered by the user in the html forms search box. In the code below, I have inserted sample code so you can see how the display appears. In actual practice, the $Source, $Topic, $Subtopic, and $References values come from the while(list($Source, $Topic,$Subtopic,$References)= mysql_fetch_row($result2)) { code line. Code:
Highlight/bold Largest Number In A Column
i have my database setup to show weights of the item. How can i tell my php script to highlight the cell in the table or bold the weight in the table? i hope what im trying to say makes sense. instead of sorting it by the heaviest weight i just want to be able to highlight/or bold the heaviest weight so the names of the items stay in alphabetical order. and i will be able to tell which item is heavier.
Highlight Found Boolean Search Terms
I have a boolean search feature for my site. On the standard non-boolean search features I have highlighting of the found terms. I want to be able to highlight found terms of a boolean search. Is there a way to highlight found search terms for a boolean result set? OR Is there a way to explode the result string of the Select statement and pick out the words used by the embedded MySql boolean search engine? Code:
Php Script Generated By Php
I am trying generate a new PHP file from an existing page using PHP. Currently I'm using the output buffer to capture content destined for the page, and then am capturing that output and writing to a file. The problem I am having is that all PHP scripts within the new page content are executed and the results are written to the new file, when I would like the PHP code itself to be written to the new file, unprocessed. So now I am trying to just store the new page as a string and bypass the use of the output buffer, but do not know how to store php code within a string without having it execute...
Using Php Generated Pictures With HTML?
I am able to create images with the use of the GDLIB. but I am not able to use these images together with HTML. I always get the message "headers are already sent.
How To Farmat Php-generated Table
the font size declaration seems to be ignored. Is it possible to set format for tables generated with php? <?php echo "<table border=1 font size=8>"; echo '<tr><th font size=8>Date</th> <th>IP Address</th> <th>Operating System</th> <th>Browser</th> <th>Referring Page</th> <tr>' ?>
Getting MySQL Generated Keys
I am a Java/JSP developer by trade but am currently developing a MySQL/PHP solution. In JSP when I run an INSERT statement on the db I am able to automatically get back a list of any generated keys (without having to do some sort of subsequent query to get the information). Is there a PHP equivilent of this?
Php-generated Png Transparency Issue In IE
I've been trying to get my page, which works perfectly in Firefox, to work in IE as well. one problem was getting the .png images to display properly, which was fixed by doing this: filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagename.png') but what of php-generated .png files? putting the php file as the src doesn't work. the php-generated images don't work at all in IE (but work fine in firefox). (the php-generated image uses a transparent color made with imagecolorallocatealpha. when I just use imagecolorallocate it shows up, but is not transparent as I want it.)
Generated PHP Web Database Forms
I'm still gaining experiance in developing PHP applications, and have completed a couple of projects already. This has prompted me to look for ways to reduce the development time for web enabled database applications. Every web database has basic operations such as add,delete,update and search. I have been creating HTML forms and processing the results with php code. I have managed to reduce the number of forms required by using the smarty template engine. I want to go a stage further and be able to produce the forms and the processing code purely by looking at some sort of schema file , or using "mysql_list_fields()" and "mysql_list_dbs()". Before I start my quest of many late nights of coding. Can any of you guys give me a head start by pointing me at a solution/hint.
Generated Images Not Printing?
I have a problem with IE and generated images (jpgraph). It displays them fine but it's not printing them. They appear as little red crosses in print preview. I've fiddled with the cache control headers as I thought that was it. Certainly IE refuses to cache pdf files sent using fpassthru and cannot open them in acrobat.
Server Generated PDF Files?
Heres what I need to happen now, I know how to do most of it, except the generated PDF form. - The server puts that information into a PDF file with a background of my chosing and emails it to a specified adress. (Its already set up to send the email) My issue is I dont know how to have the server generate the PHP form. How does it work? How do I position the text over the PDF automatically? I'm already donating $10 to the site, thanks to the help I received from UTAlan, Lytheum, and Waldir. Ill make it a total of $20 after this.
Image Src Generated Through Php File
I've built a custom image gallery, integrated with a database. all of the images are kept above the document root in a "media" directory (for security purposes); therefore, i am using a php script in the src attribute of the image tags to display the image in the browser. to accomplish this, i chose to use the PEAR package "HTTP_Download", which worked great and performed fantastically on my staging server. I chose to use content-disposition inline, and set caching options on. the problem, the images don't cache on a users machine. therefore, everytime the page is changed to display a new image, all of the thumbnails are downloaded once again...very annoying. let me re-iterate, these files are not being generated on the fly, simply sent to the user via php. Code:
Mail A Php Generated Page
I ask if it's possible to sent to email a php generated page as an html attachment or text file !? I have searched on google, but I find only how to send mail from php not hot to send a page. Any link, or doc is helpfull ! The story: I have a long products list, from where I select some items what I want to send as a price list to some people.
PHP-generated RSS Feeds And .xml Files
I want to make an RSS feed for my site. Obviously, it should be dynamic, so the only way that comes to mind is to use PHP to create the RSS. But then the filename will be .php. Most of the sites I see with feeds (digg, shoutwire, cnn, etc) have .xml files. How do they do this? I would like to have a .xml that is dynamic/always up-to-date.
Problems Saving Gd Generated File
I'm using the gd library to build graphs from db generated data. I can output the result to the browser with no problems, but when I try to save the image, I get the following error message.
PHP Generated Pages & Search Engines
I'm trying to get a basic idea of how well PHP generated pages can be spidered by search engines? I'm working for a company that keeps two versions of it's site at the moment. One copy run off of a database using CGI, and one copy entirely in HTML so search engines will find them. I've told them that this is just a bad idea, and far too time consuming. I'm under the impression that PHP pages can be found by search engines, am I wrong? I'm going to be running almost their entire database of products off of one file, will the search engines be able to find these if there aren't direct links to them? Any other suggestions as to how to keep their positions in the search engines (very good right now) would be appreciated as well.
PHP 5 Compilation Error: Libphp5.so Is Not Generated
I started from a clean, new system, with only SSH and Webmin. It's a VPS running on Fedora Core release 2. 1) I added my domain name to the BIND server 2) I downloaded the last stable Apache version, 2.2.3, and installed it using: ./configure --prefix=/usr/local/apache --enable-so --enable-module=rewrite make make install 3) I tested it, it worked. 4) I downloaded the last stable PHP version, 5.1.6, and installed it using the MINIMUM configuration possible (not even MySQL): ./configure --with-apxs2=/usr/local/apache/bin/apxs make make install "make install" gave me that error: ================================== [root@server php-5.1.6]# make install Installing PHP SAPI module: apache2handler /usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' libphp5.la /usr/local/apache/modules /usr/local/apache/build/libtool --mode=install cp libphp5.la /usr/local/apache/modules/ cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la cp .libs/libphp5.a /usr/local/apache/modules/libphp5.a ranlib /usr/local/apache/modules/libphp5.a chmod 644 /usr/local/apache/modules/libphp5.a libtool: install: warning: remember to run `libtool --finish /root/zzz/php-5.1.6/libs' Warning! dlname not found in /usr/local/apache/modules/libphp5.la. Assuming installing a .so rather than a libtool archive. chmod 755 /usr/local/apache/modules/libphp5.so chmod: cannot access `/usr/local/apache/modules/libphp5.so': No such file or directory apxs:Error: Command failed with rc=65536 ================================== The problem is that libphp5.so is not generated from "make". I found those related links: http://www.fedoraforum.org/forum/archive/index.php/t-23665.html http://bugs.php.net/bug.php?id=27795 Following the recommendations I tried: 1) using the bz2 version of the PHP distribution and not the gz one 2) I installed getText ( http://www.gnu.org/software/gettext/ ) because some say an included library, "libintl.so", could help. But I couldn't find that library after getText was sucessfully compiled. 3) I chomed everything to 777 in the php directory 4) I installed the last stable libtool, 1.5.22 Nothing worked, I still have that libphp5.so error. Any help would be really appreciated. And I really mean it!
Are Multiple GD Generated Images Possible On One Page?
I've been experimenting with generating PNG files via PHP and GD. All was going fine, until I tried to put more than one image on a single page. <img src="draw.php?text=Picture1"><br> <img src="draw.php?text=Picture2"><br> <img src="draw.php?text=Picture3"><br> The example above produced 3 images, but they all have 'Picture3' on them. Seems like theres only 1 temp storage area for the images?
Strange File Auto Generated?
I am using Linux/PHP4 + Smarty, sometimes I found some strange file auto generated under the temp folder for smarty cache, e.g. phpNd7W05 Anyone know the reason for this file?
How To Handle Special Characters In RSS Generated By PHP?
I generate RSS 2.0 using PHP from mysql DB, for example: echo "<title>" . $title . </title>"; echo "<link>" . $link . </link>"; echo "<description>" . $description . "</description>"> The problem is, sometime there are special characters in $description or $title, for example, trademark symbol. Is there a function which can remove these characters? I tried to use htmlspecialchars ($description), which only work with HTML tags.
Open URl Wich Is Generated By A Script?
I just started to get in touch with php and use it as extension of my Java Applets..... How can I open a URL wich is of this kind: http://www.host.com/?alotofdata right now I use this script: <?php echo(" <W> "); echo($key); $file = fopen ($key, "r"); $contents = ""; while (!feof($file)) { $contents .= fread($file, 8192); } fclose($file); echo($contents); ?> the first two lines are mere debugging help the key ist set to the right URL but it only receives what it would get if I open the Address: http://www.host.com/ is there a way to open the right connection? (hopefully in an easy way) maybe I searched for the wrong keywords but google didn't bring anything
Loading Times For Php Generated Pages
I've just noticed on my own surfing of the net and some php pages that i've done. especially long pages.... that they seem to load in blocks... one section at a time is there some sort of buffering or something that is doing this and can be turned off? I"m not that experienced in php... but know enough.
Storing Pictures Generated Witn GD
I'm trying to make php store a picture (on the server) that have been resized by GD. The picture is downloaded from a browser. But I would like to store this file in different sizes. To save downloadtime and cpu-power I wish to do this only once while downloading the file to the server.I can resize files, but I'm unable to store them.
Php File As String Generated To Html
I have a page going on a local server but the pages are going to be hosted on another server, which doesn't support php and MySQL. So basicly have to generate the php files into html files. The pages on the localserver are all based on a template page Main.php?Cat=Home So this is what I'm trying to do. either...open the php template pages in another file then write them as html or...export the php template as html when viewed.So far all I got to see is resource id # 1 Just a little push on the file handling as a string would be much appriciated.
Passthru + Auto Generated Headers
I'm slightly confused with the passthru() command. The program I call writes html headers itself. However, passthru() makes apache sending some generated headers first. There's no fault with spaches in the code etc, I think. Here's an simplified example: $ cat /www/example.php <? passthru("cat /tmp/output"); ?> $ cat /tmp/output Content-Type: text/html <HTML><HEAD></HEAD>Message</BODY></HTML> $ curl -i "http://localhost/example.php" HTTP/1.1 200 OK Date: Sat, 16 Jul 2005 14:47:29 GMT Server: Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7d DAV/2 PHP/5.1.0b3 X-Powered-By: PHP/5.1.0b3 Content-Length: 66 Content-Type: text/html Content-Type: text/html <HTML><HEAD></HEAD>Message</BODY></HTML>
Magpie RSS Rejects PHP Generated RSS Feed
Can any see why Magpie RSS won't accept this RSS Feed (that is valid according to the Feed Validator website). This is the code that generates it. A SQL query is run first into $result and then:
How To Retain The Elements Generated Using InnerHTML
Iam using PHP with Smarty template engine . I am adding the row elements dynamically using innerHTML by Javascript.But when the user pressed the back button or refresh the browser the dynamically generated elements goes off. I want to retain that with user entered values for that what shall i do? Files Details:
Returning A Variable Generated In A Function
I have a function that is being called from the main script using include() and there is a variable (generated inside the function),that I want to make available to the main script. I tried using "global $var" inside the function, but I get a NULL string as the value, although I should be getting a timestamp, since $var = time();
|