Quote:
Originally Posted by noir911
I tried what Centinul suggested & error_log was giving error:
PHP Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING
|
That's because of what I said in my reply earlier about having array variables embedded in a string.
Quote:
So I removed " from the code, now it displays the data but I still get error in error_log:
Quote:
PHP Notice: Undefined index: FirstName in /path/to/php/file
|
|
If it is displaying the data, then the index is defined, so I don't know what the log message is telling you. It would show if you called the page without posting the data, but you didn't say you'd done that.
But in any case, it's not something to worry about
: it's only a 'notice', so you can safely ignore it: PHP knows how to handle it if you ask for an undefined index; it's just warning you here in case you weren't expecting it.
Removing the quotes from array fields will work (as you discovered), but is not the preferred way of doing it; as with your original error, it is an out-dated method of doing things in PHP. See my previous post for the correct syntax, using {curly braces} to embed an array variable in a string.
As you see, the way you've done it works, but it is
Quote:
The PHP form doesn't _save_ the data for later viewing. How can I save the data in the PHP form so that someone can view it later?
|
Ah, now that's a whole other tutorial. You'll need to google for the PHP file handling functions (fread(), fwrite(), gets(), puts(), etc) and possibly the database handling functions, if you have access to one (probably mysql_xxx, though there are other databases). Far too much in there to discuss the whole topic here, but google for some tutorials.
Quote:
Here's the current PHP code (...snip...)
|
Please please please make your HTML code XHTML-compliant. It's making my eyes bleed looking at that code!!!
1) Lower case tags.
2) All attribute values enclosed in quotes.
3) All tags closed, even <br /> and <input ... />
Okay, so you don't *have* to do that if you don't want to; rather spend time making your code work first!
... it's just that I've spent a lot of time and effort fixing other people's HTML recently. The XHTML standard has been around for some years now, and it's a bit heart-breaking to see the old coding styles still being written.
Out of interest, are you just learning PHP now? If so, where are you learning it from? You really need to get some more up-to-date tutorials -- all the mistakes you've made are correct coding style for PHP3, but that's been obsolete for years.