Fwd: variable not being rendered
| From: | Dustin Krysak | Date: | Sat, 04 Dec 2004 20:57:31 +0000 |
| Subject: | Fwd: variable not being rendered | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203494@lists.php.net to get a copy of this message | ||
Answering within the email below....
d
On 4-Dec-04, at 3:16 AM, php-general-digest-help@lists.php.net wrote:
From: Jason Wong <php-general@gremlins.biz> Date: December 4, 2004 12:04:18 AM PST To: php-general@lists.php.net Subject: Re: [PHP] variable not being rendered On Saturday 04 December 2004 15:36, Dustin Krysak wrote:I did run it... that is the reason I posted. As I stated, When I view source, the result is blank.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.
echo $_SERVER['PHP_SELF']; shows the proper result. print_r($_SERVER['PHP_SELF']); shows the proper result print $editFormAction ; shows the proper result<?php $editFormAction = $_SERVER['PHP_SELF'];What does print_r($_SERVER) show? What does print $editFormAction show?
Well I changed it to: print '<form action="'.$editFormAction.'" method="post" name="ml_form" id="ml_form">'."\n"; and I still had the same result. the source of the page when viewed in the browser was: <form action="" method="post" name="ml_form" id="ml_form"> So as you can see the "$editFormAction" is still not being rendered. So I am going to add the following info, I have a page that is required once that contains my functions. and I defined a function to print out this form. My code for that is: <?php // create subscribe form function sub_form() { print '<form action="'.$editFormAction.'" method="post" name="ml_form" id="ml_form">'."\n"; print '<p><input name="email" type="text" id="email" size="25"></p>'."\n"; print '<p><input type="submit" name="Submit" value="Subscribe"></p>'."\n"; print '</form>'; } ?> So would my issue be that I formatted my function wrong? Or that the page is included? Dustinprint "<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).
-- Jason Wong -> Gremlins Associates