Page 1 of 1

BIG PROBLEM with my php coding... PLEASE HELP!

Posted: Sat Aug 30, 2008 9:03 pm
by Sylvia
here is the code i have so far, only i can't finish it because i can't figure out how to tell the variables to post somewhere else if the first box is already filled:

***** PLEASE USE THE CODE AND PHP TAGS WHEN POSTING CODE *****

Code: Select all

<?php
 
$name= $_POST['txtName']
$email= $_POST['txtEmail']
$comment= $_POST['txtComment']
[b]
//This is where I'm blocked[/b]
if($name, $comment=)
{[b]
//And here too...[/b]
?>
*sign* talk about a no-brainer!
***** PLEASE DO NOT POST PERSONAL EMAIL ADDRESS IN THE FORUMS *****

BTW is it possible to make a guestbook without having to use MySql? Cuz thats what im actually trying to do. For some weird reason, my computer is making it impossible for me to register a new user on MySql.

Re: BIG PROBLEM with my php coding... PLEASE HELP!

Posted: Sat Aug 30, 2008 10:09 pm
by cap2cap10
MySQL is supposed to make life easier for you. I don't understand what you mean by getting the variables to post somewhere else if the box is filled? Posted variables to a php page basically hangs in limbo until you either echo '$variable' or print "$variable" what ever it may be.

In an text box like the following:

<input type='text' name='MySQL field' value=' can be anything($variable) or nothing(blank)' size='25'>
what kind of error messages are you getting with mysql?

Batoe

Re: BIG PROBLEM with my php coding... PLEASE HELP!

Posted: Sat Aug 30, 2008 10:22 pm
by Cut
Does the first box correspond to $_POST['txtName']? If you want to do something only when that box is filled, you would use:

Code: Select all

 
if ($name != '') {
 //do something
}
 
"Posting somewhere else" is possible, but complicated and not at all necessary for a guestbook. Please explain exactly what you're trying to do.

Also, you need a semicolon after your variable declarations:

Code: Select all

 
$name= $_POST['txtName'];
$email= $_POST['txtEmail'];
$comment= $_POST['txtComment'];