Page 2 of 6 FirstFirst 123456 LastLast
Results 11 to 20 of 55

Thread: Need PHP Code

  1. #11
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    No one looks at codes >.>

    And anyone who wants to help me add me to MSN *REMOVED* ;D

    Correctable (Forum Moderator) - Do not give out personal information!
    Last edited by lMattz; 09-08-2006 at 08:13 AM.

  2. #12
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Maybe something in your code you already have is interfering with it and making it send the message anyway.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  3. #13
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    Yes, there is a section for coding

  4. #14
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    This is what i have now..

    Code:
    <?php
    
    $name = $_POST['name'];
    $message = $_POST['message'];
    
    $tag = ("<font size=\"1\" face=\"verdana\">
    <b>$name</b>; $message
    </font><br><br>");
    
    $read = fopen("content.txt", "r");
    $contents = fread($read, filesize('content.txt'));
    fclose($read);
    
    $write = fopen("content.txt", "w");
    fwrite($write, "$tag $contents");
    fclose($write);
    
    print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";
    
    if(!$name) {
    
    echo "
    
    <script language='javascript'>
    
    alert('Fill in your name');
    
    </script>
    
    ";
    
    } 
    
    ?>

  5. #15
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Ooooh i know brb.

    Nvm.

    Edited by ---MAD--- (forum moderator): Please do not pointless post, thanks
    Last edited by ---MAD---; 08-08-2006 at 10:00 PM.

  6. #16
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Because it's refreshing before the Javascript is sent.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  7. #17
    Join Date
    Aug 2006
    Posts
    282
    Tokens
    0

    Default

    Hmm so post the code which should work then pls.

  8. #18
    Join Date
    Aug 2006
    Location
    United Kingdom
    Posts
    207
    Tokens
    0

    Default

    Try:

    PHP Code:
    <?php

    $name 
    $_POST['name'];
    $message $_POST['message'];

    $tag = ("<font size=\"1\" face=\"verdana\">
    <b>
    $name</b>; $message
    </font><br><br>"
    );

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

    $write fopen("content.txt""w");
    fwrite($write"$tag $contents");
    fclose($write);

    if(!
    $name) {

    echo 
    "

    <script language='javascript'>

    alert('Fill in your name');

    </script>

    "
    ;
    }

    else {

    print 
    "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";


    }

    ?>
    Last edited by Fujitsu; 08-08-2006 at 09:11 PM.
    PHP Code:
    [LEFT]<?[/LEFT]
    [
    LEFT]$name $_GET['name'];[/LEFT]
    [
    LEFT]echo "Hi, your name is $name";[/LEFT]
    [
    LEFT]?>[/LEFT]
    [LEFT][/LEFT]

  9. #19
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    that wont work. theres a little error



    Try:



    PHP Code:

    <?php



    $name 
    $_POST['name'];

    $message $_POST['message'];



    $tag = ("<font size=\"1\" face=\"verdana\">

    <b>
    $name</b>; $message

    </font><br><br>"
    );



    $read fopen("content.txt""r");

    $contents fread($readfilesize('content.txt'));

    fclose($read);



    $write fopen("content.txt""w");

    fwrite($write"$tag $contents");

    fclose($write);



    if(!
    $name) {



    echo 
    "



    <script language='javascript'>



    alert('Fill in your name');



    </script>



    "
    ;

    }



    else {



    print 
    "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";








    ?>
    oops lost the error
    Last edited by ClubTime; 08-08-2006 at 09:15 PM.

  10. #20
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Make sure you use some sort of frame to display the input and output seperatly

Page 2 of 6 FirstFirst 123456 LastLast

Posting Permissions

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