[PHP] variable not being rendered
Hi there, I have some code where I am using the $_SERVER['PHP_SELF'] array to reference my script for a form action... now for some reason the file name is not being rendered out. I am including only small snippets of my code to see where my error is... ?php $editFormAction = $_SERVER['PHP_SELF']; print form action=\.$editFormAction.\ method=\post\ name=\ml_form\ id=\ml_form\\n; ? Now there is much more code, but these are the important points. All I am doing is assigning a variable a value from the $_SERVER array. Then print out a form with PHP, and reference that variable for my form action the HTML is rendered as normal. But the form action page is not there when I view my source. I am sure it is a SIMPLE error... But my brain block is getting larger the more i look at this. help cries the newbie! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable not being rendered
On Saturday 04 December 2004 15:36, Dustin Krysak wrote: Hi there, I have some code where I am using the $_SERVER['PHP_SELF'] array to reference my script for a form action... now for some reason the file name is not being rendered out. I am including only small snippets of my code to see where my error is... I know this is not your actual code, but did you actually run this? I can't see any errors in it and it should work fine if you're using a recent version of PHP. ?php $editFormAction = $_SERVER['PHP_SELF']; What does print_r($_SERVER) show? What does print $editFormAction show? print form action=\.$editFormAction.\ method=\post\ name=\ml_form\ id=\ml_form\\n; As you're not placing variables inside your print statement you might as well use single-quotes: print 'form action='.$editFormAction.' method=post name=ml_form id=ml_form'.\n; This does away with all the backslashes (which gives me a headache). But if you're going to be using double-quotes then there's no reason to break out of it: print form action=\.$editFormAction.\ method=\post\ ^ -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* BOFH Excuse #235: The new frame relay network hasn't bedded down the software loop transmitter yet. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php