Broken link php code

Discussion in 'PHP' started by plowdis, Oct 25, 2007.

  1. #1
    Hi everybody, this is my first post and i m glad i found digital point...
    I am a newbie at php and i m trying to make a "report broken link" button, if someone clicks the report button the url of the current page will be added to a text file ..
    one of the problems i have is that i donr want the page to reload or to go to another page after clicking the button (is ajax the solution for this ?) ..

    anyway here is what i did so far ...
    ===================================
    <form action="report.php" method="post">
    <input type="submit" value="submit">
    ====================================


    and in report.php the code is :
    =================================
    <?php
    $f=fopen("text.txt","a");
    fwrite($f,"URL: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]<br>\n");
    fclose($f);
    ?>
    ====================================


    is there a better way to do this as what i did is not doing what i need ..

    thank you in advance
     
    plowdis, Oct 25, 2007 IP