Is my jquery code to post data in the php page is ok ?
Please see html,jquery code in jsfiddle- http://jsfiddle.net/gL2yz/
My php code-
<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: POST, GET");
header("Access-Control-Allow-Headers: x-requested-with");
mysql_connect("localhost", "***", "***") or die("Connection Failed");
mysql_select_db("funiks_phonebook")or die("Connection Failed");
$chkbox = $_POST['chkbox'];
$txtbox = $_POST['txtone'];
$txtbox1= $_POST['txttwo'];
/*foreach($txtbox as $a => $B)/>/>/>
echo "$chkbox[$a] - $txtbox[$a] - $txtbox1[$a] <br />";*/
$arr = array('a' => $chkbox, 'b' => $txtbox, 'c' => $txtbox1);
foreach($arr as $value)
echo $value . "<br>";
// echo json_encode($arr);
?>
This post has been edited by Dormilich: 02 December 2012 - 03:10 AM

New Topic/Question
Reply



MultiQuote



|