Page 1 of 1

Functions

Posted: Sat Apr 12, 2003 1:45 pm
by leebo
Is it possible to do the following ?

I`m using sessions but i need only to register them after someone clicks a button to go to the next page ??

something like:

Code: Select all

function addsession() 
{

session_register("session1");
session_register("session2");
session_register("session3");
session_register("session4");
}


<a href="nextpage" onclick="addsession()" > next page</a>

This does not work as I have tried it but does anyone know how I could register sessions only just before it goes to the next page ??

God php is HARD !!!!!!!!!!

Posted: Sat Apr 12, 2003 1:50 pm
by twigletmac
<a href="nextpage" onclick="addsession()" > next page</a>
onclick is a JavaScript event, JavaScript is client-side, PHP is server-side and has finished processing before any JavaScript is called. You cannot use onclick events to run PHP functions.

Why do you have to register the session variables before the next page?

Mac

Posted: Sat Apr 12, 2003 2:04 pm
by leebo
Its a bit complicated but here goes:

i have a form where you can enter details:

Name
contact number
uploaded picture
description of picture


when page1 goes to page2 it displays all the details on page2.

if i session_register the details on page2 for when it goes to page3 - if you click back button and change details on page1 then when submitted to page2 again it does not alter the differences so i cannot use sessions on page2 (unless you can tell me how to do it )

I need all details passing through to page3 to finish off the submitting.

so i thought i could register all sessions jsut before it goes to page3.

I know its complicated but i`m just learning and i`m learning the hard way !

Please help