I use this script which submits links into a text file. The only problem is, I need the form to post dynamically on the same page. Any ideas on how this can be done? What I'm using:
To post:
<form method="POST" action="addlink.php">
Link: <input type="text name="link">
<input type="submit" name="submit">
</form>
addlink.php:
<?
$link = $_POST['link'];
$fn = 'textfile.txt';
$fp = fopen($fn, "a+");
$write = fputs($fp, $link."<br>");
fclose($fp);
?>
The call:
<?
$fn = 'textfile.txt';
$fp = fopen($fn, "r+");
$info = fread($fp,filesize($fn));
fclose($fp);
echo $info;
?>
Also any ideas on how I could make the script wait to publish the links so I can approve/delete them? I was thinking about MySQL but I'm not very great at writing DB's. I also have the jQuery lib.