Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/11123-submittion-and-retrieval/
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
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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.