|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Hi everyone!
I have been searching the internet to find my particular problem, but to no avail. I am running the following script on a WIndows 2003 system and I get the undefined variable error. I was wondering if ayone could help. I do not want to sound desperate, but this is for a client and I know very little about php. So please review this code it would be greatly GREATLY appreciated! and YES my register_globals is set to ON Here is the code. PHP Code:
Thank you so much! J.J. Mancini www.frunder.com |
|
#2
|
|||
|
|||
|
Can you post the error message. Its hard to know which variable without seeing it.
-KM- |
|
#3
|
||||
|
||||
|
And what line does it occur in? Mark the line in your code with "//Error occurs here" or something similar. Is the error a warning/notice or a fatal error? If a warning/notice, you may need to change your error severity threshold in you php.ini in order to suppress the error.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#4
|
|||
|
|||
|
Here is the error message...
Code:
Notice: Undefined variable: id_err in c:\Program Files\Ensim\Site Data\meganspantry\Inetpub\wwwroot\members\shopping \proc_order.php on line 87 Notice: Undefined variable: email_err in c:\Program Files\Ensim\Site Data\meganspantry\Inetpub\wwwroot\members\shopping \proc_order.php on line 88 Notice: Undefined variable: name_err in c:\Program Files\Ensim\Site Data\meganspantry\Inetpub\wwwroot\members\shopping \proc_order.php on line 89 Notice: Undefined variable: phone_err in c:\Program Files\Ensim\Site Data\meganspantry\Inetpub\wwwroot\members\shopping \proc_order.php on line 92 Notice: Undefined variable: shipname_err in c:\Program Files\Ensim\Site Data\meganspantry\Inetpub\wwwroot\members\shopping \proc_order.php on line 93 etc..... Thanks for the swift replies! That is awesome! |
|
#5
|
|||
|
|||
|
Now one more thing I should make note of, is the fact that I have not set-up any php mailer. Frankly I do not know how php emails stuff anyway. Am I to set-up some php mailer? Or do I need to find someother way? Could that be causing the problem? If this is not causing the problem don't worry about this question. Because the previous one is WAY more important right now.
|
|
#6
|
|||
|
|||
|
Ok here it is. This line -
elseif ($send == "no") You need to use the function strcmp to compare strings not just == (have a look on php.net for function specs). At the moment it is evaluating to true, running this section and trying to use the variables that won't be defined if the 'if' sections above didn't happen. Hope this helps, -KM- |
|
#7
|
||||
|
||||
|
You should be able to get rid of this error in one of two ways. The most likely candidate is to initialize each of the problem variables above your if blocks. Just set each one to "". The second is to edit your php.ini file so that notices/warnings don't print to the screen. This is an example of a non-fatal error that your PHP config prints to the screen, so you can either fix it or change the config so that these errors don't display.
|
|
#8
|
||||
|
||||
|
Heh, or there's another way. Kode_monkey jumped in just ahead of me with another, probably better, solution.
|
|
#9
|
|||
|
|||
|
Thanks both of you for your awesome replies.
Honestly though, I do not know to use the strcmp function. I really do not even know where to begin. This form used to work on the main server, the linux server, but now on the windoes server 2003 and with a newer version of PHP it no longer works. Could either of these solutions be able to explain why on linux and why not on Windows 2k3? And if you could include a quick code sample, that would help phenominally! Thanks again! You guys are awesome! |
|
#10
|
|||
|
|||
|
I tried this, based off another strcmp code sample....
Code:
else if (strcmp ($send) == 0) {
etc...
}
But it did not work..... Yet here is an example where what exsists, works. http://www.phpfreaks.com/phpref/34.php I don't have any idea I'll keep searching. Any input is welcomed! |
|
#11
|
||||
|
||||
|
Failing that fix, try my idea of initializing the variables, just for kicks.
|
|
#12
|
|||
|
|||
|
www.php.net use the function reference to look it up.
-KM- |
|
#13
|
|||
|
|||
|
It's WORKING!
It was an error reporting problem, just like you said dhouston! in the php.ini file I had error_reporting - E_ALL; I just had to change it to error_reporting - E_FATAL; Thank you guys so much! I'm sure you were just thinking way over my head and when really it was just some dumd little fix that you guys would have just assumed I knew. Anyway, Thanks again! This is the best forum ever! And it has the quickest and most complete user group I know! Thanks again! J.J. Mancini www.frunder.com |
|
#14
|
|||
|
|||
|
You are aware that just telling it not to inform you of the problems doesn't mean they have gone away. A quick fix like this is bound to leave you with trouble in the future. You'd do far better to find out why the messages are appearing rather than just turning them off.
-KM- |
|
#15
|
||||
|
||||
|
For the record, I made a reference to this fix in post number 3.
Kode_monkey, I think you're right generally speaking, but this error is one that's not really worth bothering with. PHP wants the variables predelcared as in C and other strictly-typed languages, when that really doesn't add anything to the code but overhead. I don't generally have a problem turning off warnings, at least once in production. |
|
#16
|
|||
|