Results 1 to 5 of 5

Thread: php code help

  1. #1
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default php code help

    ok i have a shoutbox that is in a table in my layout but everytime someone submits a shout in order for it to add the shout it has to refresh the hole layout wich is annoying is there anyway i can make it just add the shout not refresh the layout:

    addtag.php code
    PHP Code:
    <?php
    $name 
    $_POST['name'];
    $website $_POST['website'];
    $message $_POST['message'];

    if(empty(
    $name) OR empty($message))
    {
    echo 
    "

    <script language='javascript'>

    alert('You need to fill out both of the form fields...');

    </script>
    "
    ;

    }
    else
    {

    echo 
    "
    ('');
    "
    ;
    $name htmlspecialchars($name);
    $message htmlspecialchars($message);
    $tag = ("<font size=\"1\" face=\"Verdana\">
    <b>
    $name</b>: $message </font><br><br>");
    function 
    filter($tag)
    {
    $bad_words explode(','"tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
    foreach (
    $bad_words as $naughty)
    {
    $tag eregi_replace($naughty"****"$tag);
    }
    return 
    $tag;
    }
    function 
    filter2($contents)
    {
    $bad_words explode(','"tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
    foreach (
    $bad_words as $naughty)
    {
    $contents eregi_replace($naughty"****"$contents);
    }
    return 
    $contents;
    }

    $read fopen("content.txt""r");
    $contents fread($readfilesize('content.txt'));
    fclose($read);

    $write fopen("content.txt""w");
    fwrite($write"$tag $contents");
    fclose($write);
    }
    $input $contents;
    $output filter($input);
    echo 
    $output;
    $input $tag;
    $output filter($input);
    echo 
    $output;  

    print 
    "<meta http-equiv=\"refresh\" content=\"0;http://www.colin-roberts.net/test/index2.htm\">";

    // Copyright 2006 - 2007 Colin-Roberts.net

    ?>

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  2. #2

    Default

    "<meta http-equiv=\"refresh\" content=\"0;http://www.shoutbox url here\">";

  3. #3
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    already got that and when it does it refreshes everything or do you mean remove that?

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  4. #4
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Use AJAX

  5. #5
    Join Date
    May 2006
    Location
    Huntingdon (Cambridgeshire UK)
    Posts
    3,395
    Tokens
    0

    Latest Awards:

    Default

    AJAX IS EASYY!

Posting Permissions

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