Jump to content

Recommended Posts

Hi,

 

I need to pass form data from one form to another, different pages.  The form has about 6 fields (i.e. first name, last name, etc).  What is the best way to do this in PHP?  I was thinking maybe put all the form values into an array and then pass them over to the next page?

 

The trick is that I can use php for the first site/page, but not for the second (since that site does not have PHP installed). 

 

So this might have to be done via URL variables also, but I'm concerned about security.

 

Any suggestions and examples would be greatly appreciated. 

 

 

Do you have a specific example with using a session?  I'm new to PHP so I have no idea.

 

Also, the problem is that I won't be able to echo anything on the second page/form since it does not support PHP.  Any other thoughts?

You need to use session_start() at the top of any page that uses sessions.

 

This is a very basic example. Thi

 

<?php
session_start();

$_SESSION['value1'] = $_POST['form_value'];
?>

 

and if you want to echo the session you just

echo $_SESSION['value1];

 

is there any reason why the other form is php supported?

Hi AdRock,

 

The second site does not have PHP installed and unfortunately it's something I don't have control over.

 

So basically I would still need to find a solution for going from A to B where B does not support PHP but A does.

ASP

 

You can use json_encode/json_decode if ASP as code for that. Basically that serializes an array for ajax usage.

 

See if ASP supports json_decode or if you can find code to do that. If so that would be my suggestion either POST the json_encode version or send it via GET.

Thanks Premiso I'll look into that.

 

Curious: would it be possible to simple pass the form field values one by one as url variables?  Or is that impossible?

 

Yes you can, as asp should know how to handle "REQUEST" data.

following are the methods of transferring data between 2 pages of different sites

 

- GET - send all variables in URL

- POST - submit the form to the second page.

 

These methods work irrespective of languages used for both pages. Languages will come into picture to READ variablesi n the second page of assing values to FORM variables before submit in first page.

 

- Session will not work in this case as the 2 pages are in different sites and hence different domains.

 

hope i make some sense.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.