You should have defined your globals when you were checking for them, like so:
if (!empty($_POST['firstname'])) {
$fn = $_POST['firstname'];
} else {
echo '<p>You did not enter your first name</p>';
}
This will allow you to use the $fn as first name instead of having to go
through what you did in your script.
nick
"D. K. Wema" <[EMAIL PROTECTED]> wrote: Thanks Nick,
I am not able to turn on register globals due to web
host restrictions. I tried your other suggestion but
got the following message:
Parse error: parse error, unexpected
T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or
T_VARIABLE or T_NUM_STRING in
/my-directory-paths/register.php on line 6
line 6 is:
$sql = "INSERT INTO $table (firstname, lastname,
cpeyear, city, country, workplace, email, comments)
VALUES
($_POST['firstname'],$_POST['lastname'],$_POST['cpeyear'],$_POST['city'],$_POST['country'],$_POST['workplace'],$_POST['email'],$_POST['comments'])";
All variables are of varchar type in the db except for
comments which is longtext.
--
dk wema
--- Nick Jones <[EMAIL PROTECTED]> wrote:
> Check your php.ini file and see if "Register
> Globals"
> is turned on or not. It seems to me that your
> variables aren't populated with anything because the
> register globals switch is off. You have two
> options:
> turn on register globals (not usually a good idea),
> or
> change your variable names from $firstname,
> $lastname,
> etc. to $_POST['firstname'], $_POST['lastname'],
> etc.
>
> LMK if this works.
> Thanks and HTH!,
> -Nick
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "php-list" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Check me out!
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/