bbxrider Posted October 22, 2008 Share Posted October 22, 2008 this is php 5, windows xp pro, apache see the script below, responds to a basic form: <html> <body> Welcome <?php echo $_POST["name"]; ?> <br /> You are <?php echo $_POST["age"]; ?> years old. <? echo "$_server request_uri = " . $_SERVER['REQUEST_URI']. "<br />"; echo "$_server request_uri = " . $_SERVER['SERVER_SOFTWARE']. "<br />"; ?> </body> </html> i get the response below, on the one hand its giving an error but its also seems to be displaying the $_server variable info?? not sure what to make of that: Welcome bob You are 58 years old. Notice: Undefined variable: _server in C:\apache2\htdocs\1614\php\php1.php on line 15 request_uri = /php/php1.php Notice: Undefined variable: _server in C:\apache2\htdocs\1614\php\php1.php on line 16 request_uri = Apache/2.2.4 (Win32) PHP/5.2.1 mod_aspdotnet/2.2 Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/ Share on other sites More sharing options...
awpti Posted October 22, 2008 Share Posted October 22, 2008 It's $_SERVER not $_server You have other issues in the code. They should be easy to find. Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/#findComment-671356 Share on other sites More sharing options...
MadTechie Posted October 22, 2008 Share Posted October 22, 2008 Heehee, awpti read again! remember double quotes are parsed.. singles are not.. so change to singles will work <?php echo '$_server request_uri = ' . $_SERVER['REQUEST_URI']. "<br />"; echo '$_server request_uri = ' . $_SERVER['SERVER_SOFTWARE']. "<br />"; ?> $_server isn't set yet PHP is attempting to parser it.. thus getting blank.. as you don't want this use single quotes EDIT: you could also escape them ie echo "\$_server request_uri = " . $_SERVER['REQUEST_URI']. "<br />"; Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/#findComment-671358 Share on other sites More sharing options...
bbxrider Posted October 22, 2008 Author Share Posted October 22, 2008 thanks for the help so resolving occurs when using dble quote vs single, thats kinda a convenience where you can have vars resolved within a literal text string, saving having to concatenate, yes? or is there other reasons for the parsing difference between dble and single? bob Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/#findComment-672055 Share on other sites More sharing options...
CroNiX Posted October 22, 2008 Share Posted October 22, 2008 A single quote is a literal quote. Anything inside will not be parsed by php and the output is exactly what is in the quote. It will also let you do things like: echo '<a href="http://somesite.com">Some Site</a>'; as opposed to: echo "<a href=\"http://somesite.com\">Some Site</a>"; (even double quotes are taken as literal so you don't have to escape them) Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/#findComment-672089 Share on other sites More sharing options...
bbxrider Posted October 23, 2008 Author Share Posted October 23, 2008 ok thanks again for the followup bob Quote Link to comment https://forums.phpfreaks.com/topic/129496-newbie-_server-question/#findComment-672515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.