more PHP quandries

He has: 1,380 posts

Joined: Feb 2002

ok...i know i made a post earlier, and thanks...but now i'm having another problem...i have this code that acts as a form processor...two fields "subject" and "body"...it says its posting...but it doesnt post anything but lines...heres the posting code:

<?php

 
function validate_form()
  {
    global
$subject, $body;

   
$errors=0;
    if (!
trim($subject))
    {
    echo
"<BR><font color=\"red\"><B>Subject</B> is required.</font>";
   
$errors++;
    }

    if (!
trim($body))
    {
    echo
"<BR><font color=\"red\"><B>Message Body</B> is required.</font>";
    }

    switch (
$errors)
    {
    case
0:
        return
TRUE;

        case
1:
        echo
"<BR><BR><font color=\"red\">Please use your browser's back button to return to the form.";
        return
FALSE;

        default:
        echo
"<BR><BR><font color=\"red\">Please use your browser's back button to return to the form.";
        return
FALSE;
        }
    }

$ok = validate_form();
function
update_database()
{
          echo
"<br>Updating database.";
      echo
"<br><a href=\"http://westernciv.sarvihosting.com/baseball/index.html\">Click here to return to the main page</a>";

$fp = fopen ("/home/westernc/public_html/baseball/data.txt", "a");
 
fwrite($fp, "$date()\n");
 
fwrite($fp, "$subject\n");
 
fwrite($fp, "$body\n");

 
fclose ($fp);
}

if (
$ok) {
      
update_database();
}
?>


</BODY>
</HTML>
'

it ends up posting date()' with two hard enters after it...that should be posting the date that it was posted..correct? and the other ones just dont show at all...any help is appreciated! thanks

He has: 1,380 posts

Joined: Feb 2002

nevermind...nike_guy_man helped me out...thanks

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.