Jump to content

Archived

This topic is now archived and is closed to further replies.

beavis2k6

submittion and retrieval

Recommended Posts

Hi guys and gals,

Ive been playing around with html for a few years now and know the very basics to put a page together. Recently i have also been playing around with PHP...such a handy tool.
Anyway, im looking for a way to make a text box, on a php page, where people can type in a link to a webpage, then when they press the submit button, it adds it to a text file or something similar (not MySQL).
Once its in this file i would like to know a way of viewing the text from it, in the body of another php page....ive tried several things but with my limited knowledge, have not come up with anything.

Thanks in advance,
Beavis

Share this post


Link to post
Share on other sites
[a href=\"http://www.totallyphp.co.uk/scripts/text_file_hit_counter.htm\" target=\"_blank\"]http://www.totallyphp.co.uk/scripts/text_f...hit_counter.htm[/a]

You should be able to make modifications to this script to help you. When writing to the file, you probably need to use:

[code]
<a href='".$_POST['link']."'>".$_POST['name']."</a><br />
[/code]

Where the POST values are taken from the form. You need to name the textboxes 'link' and 'name' ans set the form action to the PHP file location.

Stephen

Share this post


Link to post
Share on other sites
Basically:

[code]$data = '<a href="' . $_POST['link'] . '">' . $_POST['name'] . '</a><br />';

$file = f.open('file.htm', 'a+');
f.write($file, $data);
f.close($file):[/code]

(remove the dots from f.open, f.write, and f.close)
Important note: The file must be properly CHMOD'ed

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.