Page 1 of 3 123 LastLast
Results 1 to 10 of 28
  1. #1
    Join Date
    May 2006
    Posts
    50

    I need some help plz

    ok I hate to be a newbi with all this
    but if some one could help me I followed everything in the vtms and got the test DB working and receved the db working message
    but when I set up the guest book it does not work
    I dont know if its in my ini files or coading
    is there any one out there that could help me look at my coading and ini files and tell me what I am doing wrong
    again I am sorry for being a newbi

  2. #2
    Join Date
    Dec 2003
    Location
    Tananger, Norway
    Posts
    1,461
    Here's what I want you to do:
    - Post the code you've written. The exact page that you're having trouble with.
    - The error message you get when you go to the page. If you get any.

  3. #3
    Join Date
    Jul 2004
    Location
    N29° 22.725' X W95° 6.452'
    Posts
    343
    To receive the best help I would suggest that you post any error messages you are getting along with the code that is causing you problems so that people can look it over for mistakes, typos etc...

    also describing in detail what problems you are having will help diagnose issues. Let us know what results you are trying to achieve and what results you are actually getting.

  4. #4
    Join Date
    May 2006
    Posts
    50

    here is the code and error

    Parse error: parse error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\guestbook.php on line 17


    code



    <?php
    require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
    $link = mysql_connect($db_host, $db_user, $db_password)
    or die('Could not connect: ' . mysql_error());
    mysql_select_db($db_name, $link);

    $name = $_POST["txt_name"];
    $len = starlen($name);
    //Only write to database if there's a name
    if ($len > 0)
    {
    $email = $_POST["txt_email"];
    $comment = $_POST["txt_comment"];
    $date = time();

    $query = "INSERT INTO guesbook (autoID, name, email, comment, date_auto) VALUES (NULL, '$name', '$email', '$comment', '$date')";
    mysql_query($query, $link) or die(mysql_error());
    }
    ?>
    <html>
    <head>
    <title>Guestbook</title>
    </head>
    <body>
    <center>
    <form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
    <font face="arial" size="1">
    Name: <input type="text" name="txt_name">&nbsp;
    Email: <input type="text" name="txt_email"><br><br>
    Comment:<br>
    <textarea style="width: 75%" rows="10" name="txt_comment"></textarea>
    <center><input type="submit" value="Submit"></center>
    </font>
    </form>

    </center>
    </body>
    </html>

  5. #5
    Join Date
    Jul 2004
    Location
    N29° 22.725' X W95° 6.452'
    Posts
    343
    $query = "INSERT INTO guestbook (autoID, name, email, comment, date_auto) VALUES (NULL, '$name', '$email', '$comment', '$date')";

  6. #6
    Join Date
    May 2006
    Posts
    50

    thanks that helps alittle but now I am getting this error

    Notice: Undefined index: txt_name in C:\Program Files\Apache Group\Apache2\htdocs\guestbook.php on line 7

    Fatal error: Call to undefined function starlen() in C:\Program Files\Apache Group\Apache2\htdocs\guestbook.php on line 8

  7. #7
    Join Date
    Aug 2003
    Location
    Madrid - Spain
    Posts
    1,153
    If I'm not wrong this is the error:
    Quote Originally Posted by Tmacha
    $query = "INSERT INTO guesbook (autoID, name, email, comment, date_auto) VALUES (NULL, '$name', '$email', '$comment', '$date')";
    Don't use ' because $date is an integer... so it would be this way:

    Code:
    $query = "INSERT INTO guesbook (autoID, name, email, comment, date_auto) VALUES (NULL, '$name', '$email', '$comment', $date)";
    Hope it works
    n4x0 -- C++ Programmer
    Tank Game - Progress: 11%

  8. #8
    Join Date
    Jul 2004
    Location
    N29° 22.725' X W95° 6.452'
    Posts
    343
    strlen(), got to watch those typos...

  9. #9
    Join Date
    Aug 2003
    Location
    Madrid - Spain
    Posts
    1,153
    Quote Originally Posted by Tmacha
    Fatal error: Call to undefined function starlen() in C:\Program Files\Apache Group\Apache2\htdocs\guestbook.php on line 8
    It is strlen()

    Quote Originally Posted by mcarman
    strlen(), got to watch those typos...
    You beat me
    n4x0 -- C++ Programmer
    Tank Game - Progress: 11%

  10. #10
    Join Date
    May 2006
    Posts
    50

    sweet ameking some progress

    but I am still getting this

    Notice: Undefined index: txt_name in C:\Program Files\Apache Group\Apache2\htdocs\guestbook.php on line 7

Page 1 of 3 123 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
  •