Answering within the email below....
d
On 4-Dec-04, at 3:16 AM, php-general-digest-help@xxxxxxxxxxxxx wrote:
From: Jason Wong <php-general@xxxxxxxxxxxx> Date: December 4, 2004 12:04:18 AM PST To: php-general@xxxxxxxxxxxxx Subject: Re: 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.
I did run it... that is the reason I posted. As I stated, When I view source, the result is blank.
<?php
$editFormAction = $_SERVER['PHP_SELF'];
What does print_r($_SERVER) show? What does print $editFormAction show?
echo $_SERVER['PHP_SELF']; shows the proper result. print_r($_SERVER['PHP_SELF']); shows the proper result print $editFormAction ; shows the proper result
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).
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?
Dustin
-- Jason Wong -> Gremlins Associates
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php