Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables not being passe from form to script 1

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi,

On my testing server which runs php 4.3.6 I have a form that passes information to a script. This works fine. However the remote server (which has just been changed - used to work on the old server) which runs php 4.3.11 doesn't seem to pass the variables over.

Same script and same data but different versions of php. Any idea why this might be so?

Richard
 
Your configuration file will be different. Maybe a change to the way you access your form variables. Accessing the $_GET and $_POST arrays is the way to get them now...

Code:
<?
  $myVar = 'nothing';
  if (isset($_GET['wibble'])) $myVar = $_GET['wibble'];
  if (isset($_POST['wibble'])) $myVar = $_POST['wibble'];
  echo $myVar;
?>

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Hmm,

I am posting from an html form. Will that make any difference?

Richard
 
You would normally post from an HTML form - so that's fine. I am referring to the PHP file that the form is submitted to. That file picks up the values of the form fields that you submitted... and it is this that may be muddied by a different config set up across the PHP installations.

I had something similar a few years back - and it forced me to learn how to access the $_GET and $_POST in a more robust manner.

Of course there may be many other reasons why your script is not giving you the expected results... but take a look at the PHP file that the form submits to and examine how the form variables are being gathered. Then the example I give above may prove more useful.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
It was a configuration setting on the new server in the end. The sysadmin looked at it and sorted it out. God knows why people move to new servers in the middle of testing/development!!

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top