calling a php page from a client withought redirection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

calling a php page from a client withought redirection

Post by pelegk2 »

i want to call from a client by pressing a button
a php file that will update a DB
but i dont want to use a forum that will redirect my page or refresh it
so s it possible?then how?
thanks in advance
peleg
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Not possible, PHP is server-side you must make a call to the server (via redirect or refresh) in order to run a PHP script.

Mac
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

javascript autorefresh not possible?
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

How about maybe you have a hidden iframe, and after the action is done, it launches a pop-up window or something?

Just a thought...

-Nay
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

yeah 1px by 1px frame would do it and invidible to the user

good idea, ive done this before and it works
(i used it to play music through the whole site even whilst refreshing, worked a charm and no-one was none the wiser)

technically that should work
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

Or....

Code: Select all

<iframe style="display:none"></iframe>

// or also

<iframe style="visibility:hidden"></iframe>
;)

I started as a designer so knowing there's an extra width without changing it, never gets off your mind. You then breathe out in relief after it's gone 8O 8) :P.

-Nay
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post by igoy »

either user Javascript Remoting (try googling it), I have read about it in some local magazine. using Javascript remoting you can make a call to server-side page (PHP, ASP) without going to another page.

another way is you can use Flash (LoadVars object).
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

Now I wonder if anyone has a Flash Backend o.O.

-Nay
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

ok i solved it easilt using new ActiveXObject("Microsoft.XMLHTTP");
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post by igoy »

what do you mean by Flash Backend, Nay ? o_O
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

i want to call from a client by pressing a button
My wacko brain guesses that this script is most probably in an administration panel (backend) where he manages them (the clients). So unless the whole world is going to see it, I don't see a point of using Flash.

-Nay
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

iframe might do it, but what about all the Mozilla/Netscape people?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

:bump: get a better browser :bump:
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

Then if you can sacrifice a height about 1 or 2 px, you can have a good ol' normal frame, hidden borders and all at the top or bottom.

That should work on all browsers.

-Nay

Yeah, Nay and his crazy ideas 8O 8).
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

iframes at the moment should be avoided, just as CSS2, object classes etc should be avoided until several 'unnamed' browsers catch up.

just use frames, no border like nay said, frames are awful and have never personally used them but looks like the only way around this problem and at least browsers support it

not sure why you dont just do it the normal way though, seems like no drawback to me
Post Reply