Re: [PHP] resubmitting $POST data to another script

2004-03-03 Thread Erwin Kerk
Chris Shiflett wrote:

It loses all new data:

input type=hidden name=post
value=?php echo htmlspecialchars(serialize($_POST)); ? /
input type=text name=this_will_be_lost /

Because of this:

$_POST = unserialize(stripslashes($_POST['post']));
I think array_merge will fix this:

$_POST = array_merge($_POST,unserialize(stripslashes($_POST['post'])));



Erwin Kerk
Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] resubmitting $POST data to another script

2004-03-03 Thread Charlie Fiskeaux II
Leif Gregory wrote:
Hello Charlie,

Tuesday, March 2, 2004, 1:54:43 PM, you wrote:
CFI I'm creating a form with 170 fields, and I'd like to create an
CFI intermediary page so the user can review their info before
CFI submitting it again to the emailing script.
Just a thought. I'm guessing you are dumping this stuff to a database
for the final result. Why don't you create an intermediate table to
hold those fields (keeping track of the record ID in a hidden input
field), then re-read that data back on the validation page, then when
they submit it there, the changes are added to the real table.
My only thinking on this is to keep it simple rather than carrying
over a ton of hidden fields. It may not be the most efficient method,
but it'd work.
I'm not dumping to a database, unfortunately, I'm just 
emailing the results. Thanks, anyway, though. I think the 
hidden fields idea is the best one; I finally found a 
solution that uses each() and list() to travel the $_POST 
array, and I think it will work nicely.

Thanks to all for your responses!

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] resubmitting $POST data to another script

2004-03-03 Thread Chris Shiflett
--- Charlie Fiskeaux II [EMAIL PROTECTED] wrote:
 I think the  hidden fields idea is the best one; I finally found a
 solution that uses each() and list() to travel the $_POST array,
 and I think it will work nicely.

You might strongly consider using foreach() instead for reasons of
performance (1000% or more faster):

http://www.blueshoes.org/en/developer/php_bench/

You could simply:

foreach ($_POST as $name = $value)
{
   ...
}

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-03 Thread Charlie Fiskeaux II
Chris Shiflett wrote:

You might strongly consider using foreach() instead for reasons of
performance (1000% or more faster):
http://www.blueshoes.org/en/developer/php_bench/

You could simply:

foreach ($_POST as $name = $value)
{
   ...
}
Hope that helps.
Sure does, thanks!

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] resubmitting $POST data to another script

2004-03-02 Thread Charlie Fiskeaux II
I'm creating a form with 170 fields, and I'd like to create 
an intermediary page so the user can review their info 
before submitting it again to the emailing script.

Since the form has so much data, I was hoping I could just 
take the entire $POST array and pass it to the emailing 
script like an HTML form POST method (so that form A sends 
its data via POST to PHP script B, which displays it for 
review; upon successful review, the user clicks Submit again 
to pass the $POST data on to Perl script C, which is 
prewritten). Is this possible?

I looked in the PHP Manual but couldn't find anything; I'm 
having a difficult time finding stuff in there, since I have 
to know what category a function falls under before I can 
look it up.

Thanks.

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Jay Blanchard
[snip]
I'm creating a form with 170 fields, and I'd like to create 
an intermediary page so the user can review their info 
before submitting it again to the emailing script.
[/snip]

When you create the view page store all of the passed variables in
hidden form fields. That way they can then be submitted on to the next
script.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread André Ventura Lemos
I had a similar problem, but with much lesser fields, so I passed the
$_POST to $_SESSION, but I guess there's a more practical way to do
this, or so I hope. Having said this, I'm also interested in an answear
:-)

On Tue, 2004-03-02 at 20:54, Charlie Fiskeaux II wrote:
 I'm creating a form with 170 fields, and I'd like to create 
 an intermediary page so the user can review their info 
 before submitting it again to the emailing script.
 
 Since the form has so much data, I was hoping I could just 
 take the entire $POST array and pass it to the emailing 
 script like an HTML form POST method (so that form A sends 
 its data via POST to PHP script B, which displays it for 
 review; upon successful review, the user clicks Submit again 
 to pass the $POST data on to Perl script C, which is 
 prewritten). Is this possible?
 
 I looked in the PHP Manual but couldn't find anything; I'm 
 having a difficult time finding stuff in there, since I have 
 to know what category a function falls under before I can 
 look it up.
 
 Thanks.

-- 
I/O, I/O,
It's off to disk I go,
A bit or byte to read or write,
I/O, I/O, I/O...



signature.asc
Description: This is a digitally signed message part


RE: [PHP] resubmitting $POST data to another script

2004-03-02 Thread André Ventura Lemos
I already tried that, but had problems with ' '  .

On Tue, 2004-03-02 at 21:05, Jay Blanchard wrote:
 [snip]
 I'm creating a form with 170 fields, and I'd like to create 
 an intermediary page so the user can review their info 
 before submitting it again to the emailing script.
 [/snip]
 
 When you create the view page store all of the passed variables in
 hidden form fields. That way they can then be submitted on to the next
 script.
-- 
I/O, I/O,
It's off to disk I go,
A bit or byte to read or write,
I/O, I/O, I/O...



signature.asc
Description: This is a digitally signed message part


Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Charlie Fiskeaux II
Jay Blanchard wrote:

When you create the view page store all of the passed variables in
hidden form fields. That way they can then be submitted on to the next
script.
I could do it that way, but I was hoping for a way of just 
passing all the data at once; Since there's 170 fields, 
that's a lot of data to manually handle.

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Matt Matijevich
snip
I already tried that, but had problems with ' '  .
/snip

Did you try the htmlentities function?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Marek Kilimajer
serialize(), unserialize(), watch out for escaped quotes, you propably 
need to stripslashes() before unserialize(), then addslashes on each 
variable.

Charlie Fiskeaux II wrote:
I'm creating a form with 170 fields, and I'd like to create an 
intermediary page so the user can review their info before submitting it 
again to the emailing script.

Since the form has so much data, I was hoping I could just take the 
entire $POST array and pass it to the emailing script like an HTML form 
POST method (so that form A sends its data via POST to PHP script B, 
which displays it for review; upon successful review, the user clicks 
Submit again to pass the $POST data on to Perl script C, which is 
prewritten). Is this possible?

I looked in the PHP Manual but couldn't find anything; I'm having a 
difficult time finding stuff in there, since I have to know what 
category a function falls under before I can look it up.

Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] resubmitting $POST data to another script

2004-03-02 Thread André Ventura Lemos
No.. o_O

I'll look into that, thanks

On Tue, 2004-03-02 at 21:09, Matt Matijevich wrote:
 snip
 I already tried that, but had problems with ' '  .
 /snip
 
 Did you try the htmlentities function?
-- 
I/O, I/O,
It's off to disk I go,
A bit or byte to read or write,
I/O, I/O, I/O...



signature.asc
Description: This is a digitally signed message part


Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Daniel Clark
That would be a great function, but I haven't heard of anything like that.


 I'm creating a form with 170 fields, and I'd like to create
 an intermediary page so the user can review their info
 before submitting it again to the emailing script.

 Since the form has so much data, I was hoping I could just
 take the entire $POST array and pass it to the emailing
 script like an HTML form POST method (so that form A sends
 its data via POST to PHP script B, which displays it for
 review; upon successful review, the user clicks Submit again
 to pass the $POST data on to Perl script C, which is
 prewritten). Is this possible?

 I looked in the PHP Manual but couldn't find anything; I'm
 having a difficult time finding stuff in there, since I have
 to know what category a function falls under before I can
 look it up.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Chris Shiflett
--- Charlie Fiskeaux II [EMAIL PROTECTED] wrote:
 Jay Blanchard wrote:
 
  When you create the view page store all of the passed variables in
  hidden form fields. That way they can then be submitted on to the next
  script.

 I could do it that way, but I was hoping for a way of just 
 passing all the data at once; Since there's 170 fields, 
 that's a lot of data to manually handle.

That is at once.

You want the user to resubmit all previous form data when submitting the
second form, right? If not, you may want to restate your question, because
that is certainly how I interpreted it, and that seems to be how Jay
interpreted it as well.

Of course, you might also consider sessions, rather than passing that much
form data back and forth across the Internet.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Daniel Clark
You could loop throught the $_POST[] data and create 170 hidden fields
with about 3 lines.


 When you create the view page store all of the passed variables in
 hidden form fields. That way they can then be submitted on to the next
 script.


 I could do it that way, but I was hoping for a way of just
 passing all the data at once; Since there's 170 fields,
 that's a lot of data to manually handle.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Marek Kilimajer
Let's not make it complicated:

confirmation.php:

input type=hidden name=post value=?php echo 
htmlspecialchars(serialize($_POST)); ?

email.php:

$_POST = unserialize(stripslashes($_POST['post']));



Daniel Clark wrote:
You could loop throught the $_POST[] data and create 170 hidden fields
with about 3 lines.


When you create the view page store all of the passed variables in
hidden form fields. That way they can then be submitted on to the next
script.
I could do it that way, but I was hoping for a way of just
passing all the data at once; Since there's 170 fields,
that's a lot of data to manually handle.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Chris Shiflett
--- Marek Kilimajer [EMAIL PROTECTED] wrote:
 Let's not make it complicated:
 
 confirmation.php:
 
 input type=hidden name=post value=?php echo 
 htmlspecialchars(serialize($_POST)); ?
 
 email.php:
 
 $_POST = unserialize(stripslashes($_POST['post']));

I think the other person's suggestion (hidden fields) was made so that the
original poster doesn't lose all other POST data (since he mentioned a
second POST request).

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Marek Kilimajer
Chris Shiflett wrote:
--- Marek Kilimajer [EMAIL PROTECTED] wrote:

Let's not make it complicated:

confirmation.php:

input type=hidden name=post value=?php echo 
htmlspecialchars(serialize($_POST)); ?

email.php:

$_POST = unserialize(stripslashes($_POST['post']));


I think the other person's suggestion (hidden fields) was made so that the
original poster doesn't lose all other POST data (since he mentioned a
second POST request).
This method does not lose any post data as the whole $_POST array is 
serialized. Then it is unserialized back to $_POST array at the second page.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Chris Shiflett
--- Marek Kilimajer [EMAIL PROTECTED] wrote:
 This method does not lose any post data as the whole $_POST array is 
 serialized. Then it is unserialized back to $_POST array at the second
 page.

It loses all new data:

input type=hidden name=post
value=?php echo htmlspecialchars(serialize($_POST)); ? /

input type=text name=this_will_be_lost /

Because of this:

$_POST = unserialize(stripslashes($_POST['post']));

The method is fine, but it's no simpler than the other person's suggestion
when this specific scenario is considered. More logic is necessary to
prevent the loss of data.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Leif Gregory
Hello Charlie,

Tuesday, March 2, 2004, 1:54:43 PM, you wrote:
CFI I'm creating a form with 170 fields, and I'd like to create an
CFI intermediary page so the user can review their info before
CFI submitting it again to the emailing script.

Just a thought. I'm guessing you are dumping this stuff to a database
for the final result. Why don't you create an intermediate table to
hold those fields (keeping track of the record ID in a hidden input
field), then re-read that data back on the validation page, then when
they submit it there, the changes are added to the real table.

My only thinking on this is to keep it simple rather than carrying
over a ton of hidden fields. It may not be the most efficient method,
but it'd work.



Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site http://www.PCWize.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] resubmitting $POST data to another script

2004-03-02 Thread Chris W. Parker
Chris Shiflett mailto:[EMAIL PROTECTED]
on Tuesday, March 02, 2004 3:56 PM said:

 It loses all new data:

[snip]

 The method is fine, but it's no simpler than the other person's
 suggestion when this specific scenario is considered. More logic is
 necessary to prevent the loss of data.

it was my understanding that the second page does not introduce any new
data. it was merely a confirmation page where the previous pages data
would be displayed.



chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php