How to transfer variables to PHP ?

Good morning,
I am looking for the way to transfer data from a form to a php script.
Unfortunately my does NOT work.
Please help me.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="de">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="codebase/dhtmlx.css">
	<script src="codebase/dhtmlx.js" type="text/javascript"></script>
	<link rel="stylesheet" type="text/css" href="../dhtmlx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">
    <script src="../dhtmlx/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
    <script src="../dhtmlx/dhtmlxForm/codebase/dhtmlxform.js"></script>
	  var dhxForm;
	  var formData;
	  var Username
	  var Password
	  function doOnLoad()	{
		formData = [
		  type: "settings",
		  position: "label-left",
		  labelAlign: "right",
		  labelWidth: 80,
		  inputWidth: 120
		  type: "input",
		  name: "Username",
		  label: "Username",
		  value: "login",
		  validate: "NotEmpty"
		  type: "password",
		  name: "Password",
		  label: "Password",
		  value: "123",
		  validate: "NotEmpty"
		  type: "button",
		  name: "cmdSend",
		  offsetLeft: 87,
		  width: 82,
		  value: "send",
		  command: "doFormSend"
		dhxForm = new dhtmlXForm("dhxForm", formData);
		dhxForm.attachEvent("onButtonClick", function(name, command) {
	  function doFormSend() {
		alert("sending ...");
		dhxForm.send("php/mirror.php", "post");

<body onload="doOnLoad()">
	<div id="dhxForm"></div>

and here the code of /php/mirror.php


	if(isset($_REQUEST["Username"])) {
		echo "variable NOT set ...";
	if(isset($_REQUEST["Password"])) {
		echo "variable NOT set ...";


Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany


Could you please prvide completed demo including all needed js/css/php files?

Hi Andrei,

see attached zip file for all files required to run the html file.
The folders path has to be corrected.

Hope you can find a solution for me.
In my previous post the problem could be the on ValidateSuccess event ???

Best regards
Juergen Heyn, Wilhelmshaven, Germany (257 KB)

Demo works fine
post data: Username=login&Password=123
response from php: login123

Good evening,

unfortunately I still can NOT get the demo to run.
Not on my xampp webserver (localhost) and NOT on my webspace provider.
Attached I provide the phpinfo data from my localhost.

Any idea is very welcome.

Best regards
Juergen Heyn, Wilhelmshaven, Germany (67.5 KB)

could you please provide direct link?
add any file on server with code:

<?php print_r($_REQUEST); ?>

and provide its filename

Good afternoon,

sorry for the delay …
Here is the live link to the file:

The file where I expect the data to be sent to:

I am using Windows 7 Pro Sp 1, Browser IE 9.
I assume that there are somewhere security settings ???

Hope for help.
Best regards
Juergen Heyn, Wilhelmshaven, Germany

test001.html also works correctly

Response is:
[Username] => login
[Password] => 123

try this way:
dhxForm.send(“php/mirror.php”, “post”, function®{

Hi Andrei,

thank you for your reply.
With your suggestion the alert message from the website is correct. (see image)

But if I call mirror.php the output is only: Array()
with no further information.

Do you have any other idea ?
Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany

This is because you call mirror.php w/o params
Try this link: … _2=value_2

Good afternoon Andrei,

could you please check the following live link:

[code] function doFormSend() {
Username = dhxForm.getItemValue(“Username”);
Password = dhxForm.getItemValue(“Password”);

		params = "Username="+Username+"&Password="+Password;
		document.writeln(params);"php/mirror.php", params, callbackFunction);
		var loader = dhtmlxAjax.postSync("php/mirror.php", params);
		window.location.href = "php/mirror.php";


This works on my computer.
Is this the correct and intended way to hand over variables to a php file ???

Best regards
Juergen Heyn, Wilhelmshaven, Germany


What are you expecting from this demo?

Our form send data using ajax, in bg, it not reload page like regular form.

Dear Andrei,

it is very fustrating. I do NOT manage to transfer variables from a form to a php file.
May be it’s my fault, because I simply don’t konw how to call the next page with a button click. displays correct values in alert window.
But when I call after button click the the values are lost and it says: Array().

I read through all documentation, I tried almost very line of source code but I am not able to transfer any variable from a form to a php file.

I would appreciate if you could please provide a working sample code that demonstrates the technique of transferring variables to a php file. And how to call the this php file the variables were sent to.


Dear Andrei,

I need to get the following link to work:

If I can’t manage to get the variables from the form transfered to mirror.php I have to terminate the evaluation of any dhtmlx components.



I have a demo created for another guy (too similar problems).
It have comments inside, please check. (32.8 KB)

Dear Andrei,

thank you very much for the demo.
It works perfectly for me.

Best regards.
Juergen Heyn, Wilhelmshaven, Germany