Solved

Classic ASP, VBScript sending form POSTS to PHP

Posted on 2008-10-29
5
409 Views
Last Modified: 2010-04-21
Greetings EE Gods.
I have to combine VBScript from Classic ASP with a PHP formmail.

The formmail takes a post from a html form I cannot change.
However, If I could send the information as a session_variable???? to the php document via VBScript, that would suffice as a replacement.

How can I send "session_variables"??? to a php page, where the php page thinks it came from a form post?


Thanks
0
Comment
Question by:Evan Cutler
5 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 22829001
>>How can I send "session_variables"??? to a php page, where the php page thinks it came from a form post?

if you mean create session variables within php pages, you MUST then create it in your php scripting, you cannot "pass" session variables across different scripting languages.
0
 
LVL 58

Expert Comment

by:tigermatt
ID: 22829262

As has already been mentioned you cannot create a session variable in ASP and use that in a PHP script; they are incompatible.

What you could do on your ASP code is to build a Post Request, using the form data, and send that to the PHP page. This would mimic exactly a form which has the method="post" attribute assigned, and would pass the variables to the PHP form mailer. There's a good example of building a post request in ASP at http://www.asp101.com/samples/viewasp.asp?file=http_post.asp. If you need any more help, let me know.

-tigermatt
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 22830304
I think you MUST change the HTML form to get this information across from ASP to PHP.  There is no cross-pollination between the systems (believe me, I have tried!)

But the good news is that the appearance of the form in your browser does not need to change.  Extract the session variables you need and send them across as hidden form inputs like this:

<input type="hidden" name="ASP_SESSION_VAR_1" value= [your session data field #1] />
<input type="hidden" name="ASP_SESSION_VAR_2" value= [your session data field #2] />

In the PHP side of things, you will find these data fields in $_POST["ASP_SESSION_VAR_1"], etc.

Good luck, ~Ray
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 31511067
Didn't look right when I did it.
but it worked.

Great stuff.
Thanks
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 22967997
Thanks for the points!  Glad I was able to help. ~Ray
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Obtaining data on ASP 8 30
VBA Vbscript  Issue 9 27
Designing forms 3 19
How would I implement CDN functionality in a custom PHP-based CMS and application? 12 23
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question