PDA

View Full Version : Unable to use form data in php



arshabh.clarice
31 Oct 2012, 12:30 AM
I have been able to create a form and am submitting form data.
now the problem is i am not able to use that data in php.
i am using this code
<?
$user = $_POST['username'];




echo '{ "success": true, "msg": "Logged In" }';


?>

but i get this error


Uncaught Ext.JSON.decode(): You're trying to decode an invalid JSON String: <?$user = $_POST['usrname'];echo '{ "success": true, "msg": "Logged In" }';?>


please help

tvanzoelen
31 Oct 2012, 12:41 AM
Looks like the php is not executed but only served as a text/html file. What happens is you call the page in a browser and you just echo something. Do you get the whole content (inclu code) of the php file?

Then it is a matter of your webserver configuration that it executes php files

arshabh.clarice
31 Oct 2012, 12:52 AM
hey thanks for replying, i have got things working here.
somehow same code was not executing a while ago
thanks