Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2003, 08:02 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default PHP, i cant analyse

When we submit the form the form data is retrieved by using

$TextBoxName as per the book.
But it is not working.
If i see the PHP manual, they have given that $_POST[TextBoxName]

Whether it is given for Windows environment?
and in arrays also in the book,
 $Arr1=new array[]
it is also displaying errors.

 
Old September 22nd, 2003, 01:22 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Rajanikrishna,

For the $_POST[TextBoxName] reference

This needs to be quoted. TextBoxName in this reference is first assumed a defined constant and then is considered a string. This would throw an error message under error_reporting = E_ALL

So you would use $_POST["TextBoxName"] or $_POST['TextBoxName'];

http://us3.php.net/manual/en/language.types.string.php

The register_globals topic has been discussed quite a bit on this and the other PHP forums.

See the FAQ:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp

I don't know if $Arr1 = new array[]; is the best way of doing things.
I would think that PHP would be looking for a class named array and then choke on the brackets. The 'new' keyword is used to instigate an instance of a class. And the brackets would cause a syntax error because PHP expects a class name or reference to a constructor function.

Try $Arr1 = array(); which will create an empty array.

http://us3.php.net/manual/en/language.types.array.php

I'm still trying to track down a URL on PHP.net that explains what keywords are and which ones do what. I will post that later if I find it.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old September 22nd, 2003, 01:27 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Here is that URL:

http://us3.php.net/manual/en/reserve...erved.keywords

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old September 22nd, 2003, 02:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default


There are two things that I feel need to be mentioned:

A Windows environment should have nothing to do with how your script works. $_GET and $_POST are arrays holding data sent to you by the user either via the URL query string or a form.

Also, you should always use the PHP manual when you're confused. The PHP site has a really handy automatic search feature that searches the manual if you look for a page that doesn't exist.

For example:

  http://www.php.net/array

will take you to the manual page describing the array() function.


Let's analyze this one line:

$Arr1=new array[];

"array" is the name of a function, so there's a parse error because PHP expects parenthesis to begin a parameter list, not square brackets.

Also, PHP only uses the word "new" when creating new instances of defined classes.

Your syntax looks like you're confusing things with a more Javascript-esque approach.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
PHP Warning: PHP Startup: Unable to load dynamic l surendran Beginning PHP 1 May 29th, 2006 08:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.