Link to home
Start Free TrialLog in
Avatar of PeterdeB
PeterdeBFlag for Netherlands

asked on

How to transfer echo results to a html page?

Hi Folks,

Currently my scripts echo the results. Now I would like to transfer those results, mainly links, to a html page.
How can this be done?

Kind regards,

Dweep
Avatar of Oddsen84
Oddsen84
Flag of Norway image

How do you want to transfer these links? Do you want to add them to an existing page or insert them? Need more info first.
Avatar of PeterdeB

ASKER

Hi Oddsen84,

I would like to add them to an existing page.

Kind regards,

Dweep
Does this page contain a way to recive these links and is it a static page? If this page doesn't contain a way of reciving links and is a static page then you will need to update the site by writing directly to the sitefiles.

Mabye a better way would be to have the reciving page get it's links from a database and have the sending database send new links to the database.

If any of this isn't clear don't hesitate to ask.
ASKER CERTIFIED SOLUTION
Avatar of Anniyan
Anniyan

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 Anniyan
Anniyan

replace $whateverwasechoed with (any string/ whatever you passed as parameter to echo)

I think this is what you were looking for
I don't agree with you Anniyan although you most likely need to use these file functions in php. If you just do it this way you will brake the html format and the page won't be viewable in a browser.

If you want you can find more info here:
http://no.php.net/manual/en/function.fopen.php
http://no.php.net/manual/en/function.fclose.php
http://no.php.net/manual/en/function.fread.php
http://no.php.net/manual/en/function.fwrite.php
http://no.php.net/manual/en/function.file.php
http://no.php.net/manual/en/function.file-exists.php

These are some functions you are bound to meet if you just want to write to file. But I would strongly advise against updating a web page this way
You could also write all the links to a *.txt file and have the html page contain a bit of php which loops and reads the text out from the file and then displays it.
Hi Oddsen84,

I created validated.html containing only the necessary tags to make it a valid html page. How should I change this into a page that is capable of receiving the data?

Furthermore: using a database, will be a complicated matter, right?

Thanks for your responses,

Hi Anniyan,

I am testing your code right now thanks for your responses,

Dweep

SOLUTION
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
When I say always add a newline character I mean you should append it to the end of all links like this:

$var = 'http://www.someplace.com'."\n";
Notice the difference? I used 'single hyphens' for the link and "double hyphens" for the control character. This is because PHP interprets these differently and instead of just adding the plain text \n it is substituted with the control character for new lines(read all about it here http://en.wikipedia.org/wiki/Control_character)
Thanks!