Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do you do this?

    Hi, I need to know how you can make an updatable link on a page. For instance, have a text field where I or anyone surfing my webpage can type in the link,(ie if they wanted to do www.codingforums.com they would type in "www.codingforums.com" then click submit and have it update the page so that when anyone clicked the link it would take them to codingforums.com. How can this be done?

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Location
    Pakistan
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    u have to take all the values ( like links or any other text ) into
    DB. then u will make a page with the text field and display
    that value in the text field and update the value with simple
    update query.
    God helps those who help others.

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hmmm...

    I think I have the code you're looking for ... but I'm not sure.

    Are you looking for something that grows and remembers each link that people add or just something that remembers the last link that got typed in?

    If it's the former, let me know soon. I'm heading out of town soon but if you e-mail me (savage at bigwhitevan dot com) I'll send you my script(s) and the table file from the DB.

  • #4
    Regular Coder
    Join Date
    Aug 2006
    Location
    UK, London, Dartford
    Posts
    221
    Thanks
    3
    Thanked 14 Times in 14 Posts
    Lol, you don't need a Database, to make you send somone to a diffrent page here's a quick script i made up took me 1 min lol.
    PHP Code:
    <?PHP
    // By Lee Stevens On: 31/08/06 @ 23:26

    if (!empty($_REQUEST['url'])) {
        
    header"refresh: 3; url=http://".$_REQUEST['url']);
        echo 
    '<h1>You will be re-directed in 3 seconds...</h1>';
    } else {
    ?>
    <form name="form1" method="post" action="<? $_SERVER['PHP_SELF'?>">
      <label>
      URL: <input type="text" name="url">
      </label>
      <input type="submit" name="Submit" value="Submit">
    </form>
    <?
    }
    ?>

  • #5
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you have misunderstood what I am trying to accomplish. I want the person browsing the website to be able to submit their link and have that update the link on the page to whatever they typed in. Then the next time they or anyone else go onto the site that is the link that will show up, until they change it again. Also I do not want multiple links, just one link that can be changed at any time.

  • #6
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    PHP Code:
    // get the link
    $link file_get_contents('link.txt');
    echo 
    "<a href='$link'>$link</a>";

    //update the link
    $f fopen('link.txt''w');
    fwrite($f$link);
    fclose($f); 

  • #7
    Regular Coder
    Join Date
    Aug 2006
    Location
    UK, London, Dartford
    Posts
    221
    Thanks
    3
    Thanked 14 Times in 14 Posts
    Still need a eara to edit it here:
    PHP Code:
    <form method="post" action="edit.php?action=edit">
    <textarea cols="60" rows="20" name="edit">
    <?php
    $file 
    "link.txt";
    $fh fopen($file'r');
    $theData fread($fhfilesize($file));
    echo 
    $theData;
    fclose($fh);
    ?>
    </textarea><br>
    <input type="submit" value="Edit">
    </form>
    <?
    if($_GET['action'] == 'edit')
    {
    $fh fopen($file'w') or die("can't open file");

    $stringData $_POST['edit'];
    fwrite($fh,stripslashes($stringData));
    fclose($fh);
    }
    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •