--- Matthew Oatham <[EMAIL PROTECTED]> wrote:
> I am new to PHP and am more used to JSP. My question is - if I
> submit a form to a php3 page using action=="<? PHP_SELF ?>"  for
> some processing all is well I can see that form data. After the
> processing the page is redisplayed - but the data originally sent
> persits (in the request)

You need to be more specific here. After the processing, the page is
redisplayed? Does this mean you simply generate the appropriate output (using
include() perhaps), redirect the user somewhere, the user clicks reload, or
what? I would assume the first, but your problem sounds like you are doing
something else.

> if the user was to hit the refresh button then the data is submitted
> to the server again and if for example the php page does an insert
> into a database then a new row would be created etc...

Now this question comes up a lot. There are many ways around it, and you will
probably find more than I can mention by searching the archives. In fact, I'll
only give you one suggestion now.

If you form, form.php, submits to process.php, you can process the form with
process.php and then include a Location header that redirects the user back to
form.php:

header('Location: http://yoursite.org/form.php');

This type of redirection is transparent to history mechanisms, so even clicking
back in the browser won't cause the intermediate page to be displayed. A user
who clicks reload will be reloading the form.php page which only generates the
HTML form.

I recommend searching the archives for other alternatives and choose whichever
one seems best to you.

> Is this normal behaviour of php and jsp?

Yes.

> I am not sure but I am noticing it now with php?

Yes, it seems you are noticing it now, thus your question.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

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

Reply via email to