File: demos/demo_json_init/testForm.php

Recommend this page to a friend!
  Classes of Emmanuel Podvin  >  Blapy  >  demos/demo_json_init/testForm.php  >  Download  
File: demos/demo_json_init/testForm.php
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Blapy
jQuery plugin to load linked pages using AJAX
Author: By
Last change: better support on received json+fixes
Date: 3 years ago
Size: 631 bytes
 

Contents

Class file image Download
<?php
	if (empty($_REQUEST['firstname'])) $_REQUEST['firstname'] = '[no first name given]';
	if (empty($_REQUEST['lastname'])) $_REQUEST['lastname'] = '[no last name given]';
	$_REQUEST['pureJson'] = (empty($_REQUEST['pureJson']))? 0:1;

	$output = '{"firstname":"'.$_REQUEST['firstname'].'","lastname":"'.$_REQUEST['lastname'].'"}';

if ($_REQUEST['pureJson'])
{
	header('Content-type:application/json;charset=utf-8');
	echo $output;
}
else
{
?>
<div id="results"
	data-blapy-container="true"
	data-blapy-container-name="results"
	data-blapy-container-content="resultsnew"
>
[
	<?php echo $output;?>
]
</div>
<?php
}//end else
?>