![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| yes im another newby at all this but hopefully this is an easy quesion to answer. i have WindowsXP Proffesional with iis and latest V of PHP im dam sure ive set it up properly but when i write some simple scipts i get Undefinde Variable errors. i have a coule of news posting scripts that work okay on my computer but still get those errors, but the scripts works fine...then i upload it to my server and the errors are gone...so have i really set it up properly? anyone help?! thanx in advance | |||
|
| Advertisements |
| | #2 | ||
| > yes im another newby at all this but hopefully this is an easy quesion > to answer. i have WindowsXP Proffesional with iis and latest V of PHP im > dam sure ive set it up properly but when i write some simple scipts i > get Undefinde Variable errors. i have a coule of news posting scripts > that work okay on my computer but still get those errors, but the > scripts works fine...then i upload it to my server and the errors are > gone...so have i really set it up properly? anyone help?! > thanx in advance Are your errors coming from variables generated/created within a form being submitted to your script? If so, the most likely reason you're getting the error is because you're addressing the variables the "old" PHP way. Here's an example: Let's say that you have a form with one input field <input type="text" name="username"> and you submit it to the verify.php script for processing. Under the old way of doing things this variable was immediately available to you as $username. This is because the "register_globals" option in the php.ini file was set to 'on'. Because this creates a security concern, the developer of PHP (I think as of version 4) set this setting to "off" by default (and it should stay that way). So now, this automatic variable transferrance doesn't happen. Instead, you need to manually extract the variable from the $_POST[] array (which contains all of the fields contained in the form). So, still assuming our form has one field "username", we would address it in our "verify.php" script one of two ways: 1) We can use $_POST['username'] each and every time we reference the variable. 2) We can "import" the variable into a local variable as $username = $_POST['username']; and then we can address it as simply $username from now on. Personally, I like to use method #1 because it helps me keep things clear. But either works well. If the above discussed problem is NOT what is causing your errors you might want to go to http://www.phpfreaks.com, and read their IIS/PHP installation guide to make sure everything is in working order. HTH, Anthony M. Saffer [Founder & CEO] SCS Consulting Services "Custom Software, database, and web application development" www.safferconsulting.com Ph: (918) 542-8251 | |||
|
| | #3 | ||
| that certainly cleared up a few things...but im still getting errors for examle.... i type this.... <?php $a = 2; $b = 1; if($a > $b) { echo 'value in $a is greater than value in $b'; } ?> .......i get this error... Parse error: parse error, unexpected '<' in C:\Inetpub\wwwroot\Projects\doodle\hs~dev.php on line kinda a pain in the ass when its only a simple script!!! so what going on?? ------------------------------------------------------------------------------------------- Anthony Saffer wrote: >>yes im another newby at all this but hopefully this is an easy quesion >>to answer. i have WindowsXP Proffesional with iis and latest V of PHP im >>dam sure ive set it up properly but when i write some simple scipts i >>get Undefinde Variable errors. i have a coule of news posting scripts >>that work okay on my computer but still get those errors, but the >>scripts works fine...then i upload it to my server and the errors are >>gone...so have i really set it up properly? anyone help?! >>thanx in advance > > > Are your errors coming from variables generated/created within a form being > submitted to your script? If so, the most likely reason you're getting the > error is because you're addressing the variables the "old" PHP way. Here's > an example: > > Let's say that you have a form with one input field <input type="text" > name="username"> and you submit it to the verify.php script for processing. > Under the old way of doing things this variable was immediately available to > you as $username. This is because the "register_globals" option in the > php.ini file was set to 'on'. > > Because this creates a security concern, the developer of PHP (I think as of > version 4) set this setting to "off" by default (and it should stay that > way). So now, this automatic variable transferrance doesn't happen. Instead, > you need to manually extract the variable from the $_POST[] array (which > contains all of the fields contained in the form). So, still assuming our > form has one field "username", we would address it in our "verify.php" > script one of two ways: > > 1) We can use $_POST['username'] each and every time we reference the > variable. > 2) We can "import" the variable into a local variable as $username = > $_POST['username']; and then we can address it as simply $username from now > on. > > Personally, I like to use method #1 because it helps me keep things clear. > But either works well. > > If the above discussed problem is NOT what is causing your errors you might > want to go to http://www.phpfreaks.com, and read their IIS/PHP installation > guide to make sure everything is in working order. > > HTH, > Anthony M. Saffer [Founder & CEO] > SCS Consulting Services > "Custom Software, database, and web application development" > www.safferconsulting.com > Ph: (918) 542-8251 > > > | |||
|
| | #4 | ||
| So what line is the error on and what does the code look like surrounding that line? Is it the line with <?php (That is the only line in your example that contains '<' ) or is it some other line? Also for your echo line to work you will need to use double quotes ( " ) instead of single quotes ( ' ). Single quotes prevents the variable value substitution that you intend. "mr bungle" <aaron@modnet.com.au> wrote in message news:3F269479.30906@modnet.com.au... > that certainly cleared up a few things...but im still getting errors for > examle.... > i type this.... > <?php > > $a = 2; > $b = 1; > > if($a > $b) { > echo 'value in $a is greater than value in $b'; > } > > ?> > > > > ......i get this error... > Parse error: parse error, unexpected '<' in > C:\Inetpub\wwwroot\Projects\doodle\hs~dev.php on line > > kinda a pain in the ass when its only a simple script!!! so what going on?? > > ------------------------------------------------------------------------------ ------------- > Anthony Saffer wrote: > >>yes im another newby at all this but hopefully this is an easy quesion > >>to answer. i have WindowsXP Proffesional with iis and latest V of PHP im > >>dam sure ive set it up properly but when i write some simple scipts i > >>get Undefinde Variable errors. i have a coule of news posting scripts > >>that work okay on my computer but still get those errors, but the > >>scripts works fine...then i upload it to my server and the errors are > >>gone...so have i really set it up properly? anyone help?! > >>thanx in advance > > > > > > Are your errors coming from variables generated/created within a form being > > submitted to your script? If so, the most likely reason you're getting the > > error is because you're addressing the variables the "old" PHP way. Here's > > an example: > > > > Let's say that you have a form with one input field <input type="text" > > name="username"> and you submit it to the verify.php script for processing. > > Under the old way of doing things this variable was immediately available to > > you as $username. This is because the "register_globals" option in the > > php.ini file was set to 'on'. > > > > Because this creates a security concern, the developer of PHP (I think as of > > version 4) set this setting to "off" by default (and it should stay that > > way). So now, this automatic variable transferrance doesn't happen. Instead, > > you need to manually extract the variable from the $_POST[] array (which > > contains all of the fields contained in the form). So, still assuming our > > form has one field "username", we would address it in our "verify.php" > > script one of two ways: > > > > 1) We can use $_POST['username'] each and every time we reference the > > variable. > > 2) We can "import" the variable into a local variable as $username = > > $_POST['username']; and then we can address it as simply $username from now > > on. > > > > Personally, I like to use method #1 because it helps me keep things clear. > > But either works well. > > > > If the above discussed problem is NOT what is causing your errors you might > > want to go to http://www.phpfreaks.com, and read their IIS/PHP installation > > guide to make sure everything is in working order. > > > > HTH, > > Anthony M. Saffer [Founder & CEO] > > SCS Consulting Services > > "Custom Software, database, and web application development" > > www.safferconsulting.com > > Ph: (918) 542-8251 > > > > > > > | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: iis, php |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| Featured Websites | ||||
|