Link to home
Start Free TrialLog in
Avatar of playpool
playpool

asked on

PHP noob question - using fwrite() to write HTML hyperlinks

i keep running into the problem of how to write html code, specifically hyperlinks to an external text file.

i want to use fwrite(), but the question is how. Example:

fwrite($fp, "Webpage: <a href=".$url.

i want the file to recieve the following line

Webpage: <a href="www.link.com">link text</a><br>

the problem is the double quotes, since the href in the html tag has to be in quotes as well as the variable containing the link text...what am i supposed to do??

thanks in advance,

playpool
ASKER CERTIFIED SOLUTION
Avatar of KC_Speedball
KC_Speedball

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of playpool
playpool

ASKER

its not an echo, cuz i'm writing the line to a file. I'm using the fwrite() command, which i think would look something like this with the strip slashes

fwrite($fp, "Webpage: <a href=\"$url"\>$url</a>\n");

does that look right??

and by the way, the $url is a local variable that is assigned with its value from a form.

playpool
so after i get that done, how should i redirect the submit.php page to the page that is gonna show all the entries????

is ther a redirect command?

playpool
you can move the "trigger-part" which writes into textfile to another page.... so the form where the urls are typed in not send to php self, but to this other page...where the new url is added to textfile an after that all lines in the textfile where printed.

Bye the it is more easy to use databases instead of textfiles
i want to use a database, but the server i'm using has limited space, and its my friends, and he doesn't want to mess with installing mySQL so i'm kinda stuck.

playpool