Forum Moderators: coopster

Message Too Old, No Replies

loading a php page without posting

loading php page on the fly

         

surfmore

2:02 am on Jan 19, 2005 (gmt 0)

10+ Year Member



I have a page (a.php) that accepts input from the user via text boxes. The action of the form is set to the same page (a.php). The When the select button is clicked the following is set <input type=hidden name="updating" value="1">. This is used to update information to a database during the repost of a.php. Is there a way to load a confirmation page after the update and pass data to it on the fly without usine the <form name="arm" method="post" action="a.php">?

coopster

1:28 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, surfmore.

I'm not sure I understand what you are asking here, but I will make one comment based on pure assumption here...

It seems you are wanting to rely on form data to determine whether or not you will update a row in a file. This really isn't good practice as the form value can be compromised quite easily.

If this is a database, I would actually attempt to insert first (assuming the row has primary key/unique definitions) and update on error. Otherwise, run a select statement first to see if the row exists and update accordingly.

surfmore

3:00 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



Thanks for the welcome I have been look at the threads and there is a lot of infomation on this site.

Sorry if i was unclear it's the old first I will tell you what I want, now I am going to tell you what I really want.

Basically I would like to have a page opened from with in a php script without the user haveing to do anything.

<?php
.....update a database (this is working fine)
.....open a page mypage.php
?>

Hope this is clearer

lZakl

6:14 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



I am not quite sure this is entirely possible with php, however, you COULD tell php to echo a JavaScript. It would be fairly easy to do I think. You would just use onload and open a new window targeted to the page you want to open.

ie.

On the input side:

<input type="hidden" name="go" value="yes">

On the output side:

<?php
if ($go == "yes")
{
echo"JAVASCRIPT TO OPEN CONFIRMATION WINDOW GOES HERE";
}
?>

This is just my thought, sorry if it's not what you are looking for...

-- Zak

jamesa

9:53 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



surfmore, are you talking about redirecting the user to a different page?

<?php
.....update a database (this is working fine)
header("Location: mypage.php");
?>

surfmore

10:03 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



Yes...to show the user that the update was successful (confirmation page) also to display a requisition number that was created. So I would need to pass data to the Confirmation page. I am trying the javascript route but I am not having success. Thanks...

jamesa

11:17 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, couple ways to do this. one is to pass the info in the query string and redirect:

<? header("Location: newpage.php?reqnum=123");?>

Problem with that is people can generate phoney thank you pages so better yet, don't redirect and do this:

<?
...your database code here, then...

$reqnum = '12345';
include("thankyou.php");
die;
?>

'Die' is there so the rest of your form page doesn't render. thankyou.php would look something like:

<html><body>
Thank you, you're req number is <?=$renum?>.
</body></html>

Hope I made sense. :)

surfmore

12:31 am on Jan 20, 2005 (gmt 0)

10+ Year Member



This is great! and thank you for your input, it is greatly appreciated. I will apply the changes you suggested.