We help IT Professionals succeed at work.
Get Started

How to transfer vbscript variable to php variable on the same page?

Last Modified: 2012-05-11
I have a .php file where I retrieve data from a mysql database, I then use html on the same page to offer options based on the query result.
This is done using a form which is posted back to the same page using php_self.
I then run some calculations using a combination of html and php and then offer the user further options again using a form and php_self. the option the user chooses is posted to a text box (Text1).
I then want to use that information to send back to my database.
The problem I have is that I don't seem to be able to retrieve the information in the text box. I can retrieve it using vbscript. I get an undefined index error. Testing with Isset shows that the variable hasn't been assigned in php
My question is how can I retrieve it using php, either directly from the user choice or from the vbscript variable?
I have included my code

Sub Submit_OnClick
  Dim TheForm
  Dim Choice
  Set TheForm = Document.ValidForm
 if Choice<>"" then
'MsgBox "You Chose  " & Choice
end if
End Sub
<FORM NAME="ValidForm">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Select Service Required:
<INPUT TYPE="radio" NAME="Prices" VALUE="1"
   onClick="Text1.value = 'Fully Trackable Courier'"> Fully Trackable Courier
<INPUT TYPE="radio" NAME="Prices" VALUE="2"
   onClick="Text1.value = 'Postal Airmail Service'"> Postal Airmail Service
<INPUT TYPE="radio" NAME="Prices" VALUE="3"
   onClick="Text1.value = 'International Signed for'"> International Signed for
$var =$_POST['Text1'];
echo $var;

Open in new window

Watch Question
Most Valuable Expert 2011
Author of the Year 2014
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE