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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sylvia
Forum Newbie
Posts: 3
Joined: Sat Aug 30, 2008 8:33 pm
Location: Laval, QC, CANADA

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

Post 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.
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

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

Post 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
Cut
Forum Commoner
Posts: 39
Joined: Sat Aug 23, 2008 8:01 pm

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

Post 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'];
 
Post Reply