Re: newbie problem working with Forms - undefined constant?

From: Date: Wed, 15 Nov 2000 14:17:00 +0000
Subject: Re: newbie problem working with Forms - undefined constant?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25438@lists.php.net to get a copy of this message
On Wed, 15 Nov 2000, Philip Lindsay wrote: > Hi, > > I've really only been using PHP for three weeks though so bear with me if ^^^^^^^^^^^^^^^^^^^^^^^^^ > this sounds a bit daft. > > I have some scripts which piece together to build a message board with a > mysql database. The scripts come from the SAMS book - Teach Yourself PHP in > 24 hours (ch. 23). ^^^^^^^^ Sounds like you deserve your money back. :-) > On one of the pages is a form which extracts the users details and logs them > into the database when they join - but I receive errors such as : > > Warning: Use of undefined constant password - assumed 'password' in > c:\program files\apache group\apache\htdocs\mysql\join.php on line 11 > > I have the value of each input box as form[login], form[password] etc.. and > it seems to be tripping over these. Can anyone shed any light on this > problem? I can send the code if it may help? Generally, yes, it does help to include some code if you want the list to find the bug in it. :-) Something that might also help: the keys of associative arrays are strings and should be treated as such. I.e., it's best to have them quoted. So get in the habit of writing $form["password"] or $form['password'] instead of $form[password] You still use <input name="form[password]" type="password"> in your HTML. But if you use the latter above, PHP will first try to find a constant called password, then the string "password". HTH, Matt ---------------------------------------------------------------- Matthew Leingang http://www.math.rutgers.edu/ Rutgers University leingang@math.rutgers.edu Department of Mathematics "This signature needs no quote."

« previous php.general (#25438) next »