php-general Digest 4 Dec 2004 23:17:33 -0000 Issue 3151
Topics (messages 203493 through 203501):
Re: "Please wait" page while processing - SOLVED
203493 by: Geoff Caplan
Re: variable not being rendered
203494 by: Dustin Krysak
203495 by: Dustin Krysak
executeing another files code
203496 by: Ryan A
203498 by: M. Sokolewicz
203499 by: Marek Kilimajer
203500 by: M. Sokolewicz
203501 by: Marek Kilimajer
Re: intalling pear:db
203497 by: Info.Best-IT
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi
For anyone interested, it was a combination of issues.
First, I had to use flush() and ob_end_flush() combined to
get the page to display in IE. end_flush didn't work on its
own.
Second, I was being dim in redirecting away from the message
page - because of course it won't display after a redirect.
So you have to do the processing in the message script,
saving the result to the session. Then keep polling the
message page with a client-side refresh till the gateway
processing completes and you can re-direct to the result
page.
GC> I'm writing a checkout.
GC> When user submits their card details, I want to redirect
GC> them to page with a "please wait" message. Then redirect to
GC> the script that does the payment processing. Then when I
GC> have the response from the gateway, redirect again to the
GC> result page.
form ->> message -> processor -> result_page
GC> I've seen this done but I can't figure out how.
------------------
Geoff Caplan
Vario Software Ltd
(+44) 121-515 1154
--- End Message ---
--- Begin Message ---
Answering within the email below....
d
On 4-Dec-04, at 3:16 AM, [EMAIL PROTECTED] wrote:
From: Jason Wong <[EMAIL PROTECTED]>
Date: December 4, 2004 12:04:18 AM PST
To: [EMAIL PROTECTED]
Subject: 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.
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
--- End Message ---
--- Begin Message ---
Ok - I have been investigating a little more. I now realized it is a
question of making my variables available outside of the function. So
one thing I want to point out is that:
$editFormAction = $_SERVER['PHP_SELF']; is contained in one function.
And that:
print '<form action="'.$editFormAction.'" method="post" name="ml_form"
id="ml_form">'."\n"; is contained in another function.
The first function contains all my code for a SQL query to insert a
record. And the second function is just to create the form itself.
Now i know i also need to use the "result" function. But I am sure that
since I am using a few functions here - there might be more hitches
than I realize. So I am just asking for some pointers for dealing with
this.
thanks!
d
From: Dustin Krysak <[EMAIL PROTECTED]>
Date: December 3, 2004 11:36:56 PM PST
To: PHP <[EMAIL PROTECTED]>
Subject: 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
--- End Message ---
--- Begin Message ---
Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.
We will get back to you shortly.
Regards,
$sitename
P.S below is the message you submitted:
$message
############# End file ##########
Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail() etc...
Just a little confused....
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.4.5 - Release Date: 12/3/2004
--- End Message ---
--- Begin Message ---
Ryan A wrote:
Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.
We will get back to you shortly.
Regards,
$sitename
P.S below is the message you submitted:
$message
############# End file ##########
Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail() etc...
Just a little confused....
Thanks,
Ryan
well, seen as you've put it in a separate file, we'll need to eval it.
So, let's go.
I'm assuming $sitename and $message are already set with the correct
values before the script I'm going to show you starts:
<?php
// assume PHP 4.3.0+, otherwise use eg. $c = implode("\n",
file('email.fff'));
$c = file_get_contents('email.fff');
eval('$emailMsg = "'.$c.'";');
// [EMAIL PROTECTED] can be replaced with eg $emailAddress if you've
defined it earlier on.
mail('[EMAIL PROTECTED]', 'Re: support request', $emailMsg);
?>
hope that helps :)
- Tul
--- End Message ---
--- Begin Message ---
Ryan A wrote:
Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.
We will get back to you shortly.
Regards,
$sitename
P.S below is the message you submitted:
$message
############# End file ##########
Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail() etc...
Just a little confused....
Don't execute it, it's expensive. Simply read the file in a string and
replace all occurences that you need:
$s = str_replace(
array('$firstname', '$lastname', '$sitename', '$message'),
array($firstname, $lastname, $sitename, $message),
$s);
--- End Message ---
--- Begin Message ---
Marek Kilimajer wrote:
Ryan A wrote:
Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.
We will get back to you shortly.
Regards,
$sitename
P.S below is the message you submitted:
$message
############# End file ##########
Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail()
etc...
Just a little confused....
Don't execute it, it's expensive. Simply read the file in a string and
replace all occurences that you need:
$s = str_replace(
array('$firstname', '$lastname', '$sitename', '$message'),
array($firstname, $lastname, $sitename, $message),
$s);
actually, as far as I see, that should be equally expensive as
eval()'ing it :)
--- End Message ---
--- Begin Message ---
M. Sokolewicz wrote:
Marek Kilimajer wrote:
Ryan A wrote:
Hey all,
Heres my problem, I have this written in "email.fff"
############# Start file ##########
Hi $firstname $lastname,
We have recieved your request for support.
We will get back to you shortly.
Regards,
$sitename
P.S below is the message you submitted:
$message
############# End file ##########
Question is:
How can I get the file in my php script and fill in those variables then
send the above email message.
I know how to open a file via fread/file I now how to do the mail()
etc...
Just a little confused....
Don't execute it, it's expensive. Simply read the file in a string and
replace all occurences that you need:
$s = str_replace(
array('$firstname', '$lastname', '$sitename', '$message'),
array($firstname, $lastname, $sitename, $message),
$s);
actually, as far as I see, that should be equally expensive as
eval()'ing it :)
eval has to look for more tokens and is less secure.
--- End Message ---
--- Begin Message ---
Ryan,
Your suggestion led me to the solution. I was having the same problem with
php returning a fatal error made me think DB.php was to blame. But it ended
up being an include problem after all...
I use php 4.3.8 and my include path to the PEAR libraries was already set.
The actual problem was including my config file which defined my DSN driver.
Once I was able to successfully include the config file and actually define
the DSN info, everything was fine.
Thanks!
Tim
on 11/26/04 1:18, Ryan King at [EMAIL PROTECTED] wrote:
>
> On Nov 25, 2004, at 1:56 AM, Merlin wrote:
>>
>> Hi,
>>
>> that did not help. The pear manual says that this can be installed via
>> command line, plus "pear list" tells me that the package is installed.
>> However if I call phpinfo() there is no mentioning about pear in any
>> way?! Do I have to enable it first anyhow?`
>>
>
> How about trying a var_dump() on your DB object? For me, this is always
> the first step in trying to solve a mystery like this. Chances are,
> your DB object is really a PEAR_Error object because your failed to
> connect to your database.
>
> -ryan
--- End Message ---