Find URL And Replace With HTML Hyperlink
I have a database full of user input, some users enter in URLs.. when I display this information, I would like to go through the text, look for URLs and turn those into real hyperlinks... so I need to take http://www.whatever.com and make it a real hyperlink.
Am I in the right place? If so, how would I go about doing this?
I am using php/mysql and I would like to simply wrap a function around, for instance, my $output variable which holds the data retrieved from a user input.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Find And Replace
Hey there i have an input box but want to know the best way of doing this i want to allow people to enter in website <a href="skdfj"> safasd</a> but would prefer if they could just enter http://bla.com
Generic Find And Replace?
I don't understand preg and i have been trying for quite some time. Is there a find and replace function that just takes parameters and does the work for you? for example: find_replace($strtofind, $strtoreplacewith); when parsing any text editor file (.txt, .php, etc)
Find Replace With Regular Expressions
I'm trying to create a function to perform find and replace on data entered into a form textarea. I tried using str_replace() - but it is a too sloppy for what I need. So I'm thinking regular expressions are the way to go. There are two functions, one is a true find and replace, and the second is a "find and append" (basically finds a word in the string, and then appends another version onto the end of the string.). I've played with it allot, unfortunatly I can't get it to work right. function findreplace() { extract($GLOBALS); $find = "/^" . $_POST['find'] . "$/"; $replace = $_POST['replace']; $PATTERNS = $find; $REPLACEMENTS = $replace; $keywords = preg_replace($PATTERNS, $REPLACEMENTS, $keywords); // $keywords = str_replace($find, $replace, $keywords); return $keywords; } function findappend() { extract($GLOBALS); $find2 = $_POST['find2']; $replace2 = $_POST['replace2']; $PATTERNS = $find2; $REPLACEMENTS = $replace2; $keywords = preg_replace($PATTERNS, $REPLACEMENTS, $keywords); /* $keywords = str_replace($find2, $replace2, $keywords); */ // Append find to then end of the string $keywords .= "" . $find2; return $keywords; } What am I missing?
Find And Replace Query Variable In URI String
I am trying to find and replace the query variable relating to the session id "sid=". This is the portion of the script that has to find out where the sid= is in the string and replace it with an updated version that contains the session id. It is not finding "?s=" nor "&s=" when I run it any of the following urls. http://www.mysite.com/?func=home&sid= http://www.mysite.com/index.php?func=home&sid= http://www.mysite.com/?sid=&func=home http://www.mysite.com/index.php?sid=&func=home I commented out the parts which do not have a bearing on the basic string search function. PHP Code:
Find And Replace Text In Preg_match Array
I'm trying to change a font color html code once my preg_match_all reads the file. Now the code only shows up when a winner has been posted for that tour. Otherwise it's not visible. So I want to search the preg results which is $matches, for the "font color=3FFF5E" and replace it with "font color=FFFFFF". If the code is not found, continue what it was doing. Code:
How To List/find Html Tags In Text
What I try to do is to search a text for html tags. Why. Because I want to use nl2br on the text, but since this command add br instead of all /n it is not a nice thing to add t.x. a html list inside the text. Of course it is possible to add the list and remove all space between li tags, but this is not so readable to the writer. What I try to do is also to add nl only in the plain text and inside li and td tags. So in the li case I have to find <ul> and </ul> and <table>..
IIS Could Not Find .php File, However It Finds Html Files In The Same Dir
IIS could not find .php file, however it finds html files in the same dir..... http://localhost/test => the default.htm will be hit, no error http://localhost/test/test.php => 404 error not found( it exists in the dir) The security is set ok, something wrong with the php runtime?? Strange because my application on localhost/prog works smooth.........
Replace Text Outside Html Syntax Regexp Php
how can i replace text outside a html syntax by using reg exps in php? I mean i have a text like <h3>heading</h3> <p>text</p> <table> <tr> <td>cell1</td> <td>cell2</td> </tr> </table> or any html code. now i want all the text outside the syntax (here: heading, text, cell1, cell2) replaced by a special code like <img...>. how can i code a reg exp pattern in php, that replaces each character in the "real text" by an other piece of code, but doesnot change any of the syntax statements?
How To Replace Special HTML Tags With Attributes
I'm working with XML and sometimes it's necessary to use temporary tags, that should be replaced before showing the source. How can I delete these tags? I assume, that I require preg_replace, but I don't know how to do it. Let's say I want to replace the <iteration ... > and the </iteration> tag from the following HTML code: PHP Code:
I Need To Search And Replace Lines Of Html Code
I need to search and replace lines of html code using regular expressions. In the example below, all of the information between "href="/ and LAST_MODIFIED="0"> varies from individual entry to entry and has to be ignored. Can someone write the general expression I need to use? I've been trying to get it right to no avail. Search For...
HTML Web Page Hyperlink To Php Web Page
I am still having a problem parsing a html page with php. Code in my HTML is <? php echo '<a href="index.php">Home</a><br /> <a href="login.php">Login</a><br /> ' ?> However the link is to the Login page is: file:///C:/Program%20Files/Apache%20Group/Apache2/htdocs/TeeJayUu/login.php I am using PHP 5.0.2, Apache 2.0.52, MySQL 4.0.21, and Windows XP SP2. All pages are in the htdocs folder and the following instructions have been followed: - Copy php5apache2.dll to Apache's module dir and rename it to mod_php5.so; - Copy php5ts.dll to Apache's bin dir. Finally, add the following line to your httpd.conf file: LoadModule php5_module modules/mod_php5.so Apache has been stopped and restarted. Help - I am lost for what else to do. I want to keep this local until I have got it working.
Hyperlink
Im making a select statement and the outputs are in a table but i want the entry of a column to be hyperlink to take to another page Code:
Displaying A Hyperlink
I pull a string out of MySQL and display it in an html page using PHP. It automatically becomes a hyperlink but if it is a link to a document (www.web.com/test.doc) it won't translate it into a hyperlink. Does anybody know how I might do this?
Hyperlink Query
I have the following line that prints out a record with a link, when you click the link you get more column information in the record. I want to add another field (State) so that I can narrow down the results. How can I pass both the hcounty as I'm doing now, along with state? to the state7.php file? print " <td><bgcolor=#000000><font color=#000000 font color=#000000 face=Tahoma size=2 ><A href='state7.php?searchid=$line[hcounty]'><img src='buttondetail.gif' border=Ɔ'></img></td> ";
Replacing Www... With Hyperlink
i want to replace all entries of beginning with 'www.' and ending with ' ' with a hyperlink to that substring such as: www.google.com := <a href="www.google.com">www.google.com</> can anyone tell me the easiest way to do this?
HyperLink Validatation
I am wondering what approach I could used to validate links. I am building a simple portal type index and I would like to be able to check for broken links weekly. The Database already has a field for link status. I would like to create a script that checks for broken links and changes the status so a human can follow up on it. I am also wondering about how one would “limit” this program. I mean I don’t care if it takes 2 hours just as long as it does run rampant and cause issues with my host. Any thoughts…? I am not looking for a complete solution just a point in the right direction.
Hyperlink Per Mail
can anybody tell me how to sen a hyperlink using the php mail function. If I send a <a ref ...> it just turns up in plain text. Whats the trick
URL Text To Hyperlink
here is what i have $threadx = preg_replace("/((ht|f)tp://[^s&]+)/", "<a href="$1">$1[/url]", $threadx); $threadx = preg_replace("/(S+@S+.w+)/", "<a href="mailto:$1">$1[/url]", $threadx); can someone tell me how to make it better, this one completly screws up existing hyperlinks and <img src=""> tags... need to fix it somehow..
Hyperlink With Parameters
Is this how you print a hyperlink passing parameter action , id, qty to another php script? And printing HTML inside php? I giving three sample code in my program. I use quotation around HTML TAG and code so can read by php print command. 1. Hyperlink with parameter to pass print "<a href = "cart.php?action=Add&id=" . $column['SKU'] . "&qty=1">Add Item</a></font></td></tr>"; 2. Printing HTML tag with PHP print command print "<TR><TH>Title</TH><Price</TH><TH>Description</TH><TH>Add Item</TD></TR>"; 3. Here I try to print a drop down list with Javascript onChange event. Notice that I use concatenation between HTML TAG and PHP code. I use to respesent quoatation mark. // print the drop down that will update the qty instantly using Javascript onChange event // the following syntax will look like this in regular HTML code // <select name = "$column['SKU']" onChange = "upDateQty(this)"><option Selected>i</option></select> print "<tr width = 15% height = 25><td width = 15% height = 25><font face = verdana size = 1 color = black>"; print "<select name = "" . $column['SKU'] . ""onChange = "updateQty(this)""; for ($i = 0; $i <= 20; $i++) { print "<option"; if ($rows['QTY'] == $i) { print "SELECTED"; } print ">" . $i . "</option>"; } print "</select></font></td>";
Using A Hyperlink To Retrieve Data? Is It Possible Without?
I was wondering if it is possible to get data from a database using a hyperlink instead of a form? My situation is I have a page with a list of products (data from a mysql table) and I want to keep the info on the page small so I have limited the description and left out some info. what I want is a link at the bottom of each product that says "more details" and when clicked it creates a new page on the fly to show more info. is it possible to do this without javascript? If so How.
Hyperlink And Passing Of Variables.
I know three ways to pass variables form one page to another. The first one is to declare and set session variable. In this case if one goes to another page (by clicking on hyperlink or pressing a button) value of a session variable will be automatically seen on the new page. The second way is to set hidden variables in the form and go to new page by execution of this form (press a button or enter), and the last way, which I know, is in the declaration of hyperlink after name of a new page put after "?" names and values of variables. Sometimes I need to use the third way. However I do not like that after new page is loaded in the address line of browser one can see all variables (names and values). Can one avoid this problem?
Hyperlink And Posting To New Page!
I have a page where I have done a successful query and get search results displayed. Now I would like a link activated so that they can click on the name and go to new page with further details about that company like address hours etc.
Hyperlink - JS Function & PHP Variable
if its possible to call a JavaScript function and pass on a PHP variable in 1 hyperlink? I need to pass on variable: $lang=english And call JavaScript Function: javascript:loadScript1()
Executing Code Within A Hyperlink
I am writing a photo gallery and suppose 8 photos are displayed. When the user clicks on a button under the picture, I want it to add that picture name to a "favorites" list within the session data, but NOT leave the page the user is on. How could I do this?
Need A Script To Tell Me Where A Hyperlink Originated
Not sure if this is a php or an html question but I'll post it anyway. I have multiple thumbnail images on my catalogue page catalogue.php and they are all hyperlinked to a single page called desc.php that will give an enhanced description of the product selected. I want the desc.php page to print the contents of a text file named ?.txt based on which image was clicked on in my catalogue page. example: if I click on 1.jpg in my catalogue then I want the file 1.txt to be selected and printed on my description page. I know how to print the contents of a textfile and I know how to disect the strings of the filenames so that I can associate 1.txt with 1.jpg. What I dont know is how to retrieve the name of the image file that was clicked on the catalogue page within my script for the desc.php page If I didn't use a hyperlink image and used a form submit button instead on my catalogue page then of course I could use something like: $filename = $_POST['filename'] Hope you understood all of that.
Table Output As Hyperlink ?
i am trying to create a table generated from a MySQL query with some of the output as hyperlinks. in this way i intend that the users of the site click to see the customers registered and then click on the "hyperlink" of their customer id, which will navigate them to details about that user on another php page. PHP Code:
Passing Variables With Hyperlink
I've managed to get a MySQL database up and running and can display the data with PHP to a web page. What I'd really like to do is click on a field on the web page to display another page based on that value. As an example using a membership database, I display an index of member no and member name to a web page. I'd like the member no to be a link that when clicked on would allow me to display the entire member record. I just need to know how to pass the variable from the hyperlink to a php script to do the query.
Hyperlink To An Excel File
I have a hyperlink to an Excel spreadsheet but I'm having a bit of trouble with it. My first problem was that IE6 integrates Excel into the IE window when you click an Excel link. I overcame that by having a dummy Excel file run that had VBA code to launch the real application in a new window. That's probably too much info, but there it is. Moving on. My problem is the users will be opening up this VBA Excel application of mine from our Intranet. When they click on the link, the dummy Excel file runs, that in turn launches the real application and all is well and good. Except for one thing. When the user is done or goes back to the IE Intranet window where they launched the application, this is the error that is displayed: The page cannot be displayed: The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. My two solutions were to either have the link do two things simulatenously. You would click on the app link and it would run the application and it would also reload the Intranet home page. My second solution was to have them click the link and then it would go back to the previous page they were on all in the same click procedure/event/whatever. Code:
Basic Hyperlink Query
I have a php series of scripts/programs/files which provide a simple calendar/scheduler program. When either an email or web address/hyperlink are displayed within the output, they seem to have the browser default link colours and underline. Altho the output table/content is within a div in the web page, I seem to be unable to apply CSS styles to the div contents in this case. I have even tried !important to no avail. There does not seem to be any HTML tags in the PHP controlling them. Is it possible for anyone to help me to apply CSS styles to these links without you being able see the PHP etc? Ignore this if I am asking for the impossible/impractical.
How To Download File From Hyperlink?
How to download file from hyperlink? I successfully created a pdf file and stored the file name,location inside a table. Now i am showing the link on the page and when user click this link i wish to open this pdf file from the server on the user desktop in a popup window. $filelocation == http://locatiion/pdf/xyz.pdf i.e, echo "<a href='<?php $filelocation ?>'Click to open</a>"; Its bit scary when i read another thread about downloading big files, although my files are very tiny i mean 30kb in size.
Extractng Text From Hyperlink
I need to extract the text within anchor tags for use in building another hyperlink. In other words, if I have something like this: <a href="http://www.something.php?id=12">Blah blah blah</a> I need to get the 'Blah blah blah' part. I'm thinking that a regular expression is the way to go, but I'm having difficulty seeing how to deal with the stuff in the href attribute.
Going Back 1 DirecTory In Php Hyperlink?
how i can go back a directory from the current code: say for example in the code below im in localhost but current location in that directory is in a sub directory but i want to refer to a file back in the localhost? how do i do that? echo"<ul><li class='style9'><a href='$cat_name'.php'>'$cat_name'</a></li> </ul>";
Hyperlink In Text Area
I have a basic CMS system and the client would like to insert some links in the text area. What would you recommend the best way to do this in a textarea box? There may be several hyperlinks in 1 textarea and some may have none at all. I assume this would be some sort of javascript code or is there an easier way.
Retrieving Hyperlink Parameter Values In PHP
I have a PHP program that creates a page with several links all to the same URL but with different parameter values in the hyperlink e.g. <a href="FILENAME.php?VARIABLE=123">Click Here</a>. How do I retrieve the value of VARIABLE (=123) in file FILENAME.php?
Conditional Email Text To Hyperlink
I am trying to write a content management section for a web site. I have managed so far to use htmlarea to give users a basic, but user friendly interface by which to edit the page content. The user can add emails by symply typing john@example.com - IE automatically converts this to a hyperlink. The trouble is sometimes the users use plain text. I have been using the following line to convert plain text to a hyperlink: $pagetext=ereg_replace('[A-Za-z0-9_]([-._]?[A-Za-z0-9])*@[A-Za-z0-9]([-.]?[A-Za-z0-9])*.[A-Za-z]+', '<a href="mailto: ?subject=Email%20from%20web%20site"> |