Facing undefined variable issues while submitting form.Please help
Can anybody tell me as to what i am missing out?
I intend to call function 'process_input' for form-submission, and inside process input i am getting the ip/uid/pwd details.
$.ajax({
type : 'POST',
url : 'post_process.php',
data : {
func : 'process_input'
},
}).done(function(data) {
// show the response
$("#response").html(data);
PHP
if (isset ( $_POST ['func'] ) && ! empty ( $_POST ['func'] )) {
$func = trim ( $_POST ['func'] );
switch ($func) {
case 'process_input' :
process_input ();
break;
..........
}
}
function process_input() {
header ( 'Content-Type: text/html; charset=utf-8' );
if (isset ( $_POST ['ip'] ) && ! empty ( $_POST ['ip'] )) {
$ip = trim ( $_POST ["ip"] );
}
if (isset ( $_POST ['uid'] ) && ! empty ( $_POST ['uid'] )) {
$uid = trim ( $_POST ["uid"] );
}
if (isset ( $_POST ['pwd'] ) && ! empty ( $_POST ['pwd'] )) {
$pwd = trim ( $_POST ["pwd"] );
}
echo "$ip $uid $pwd <br>";
...
}
Notice: Undefined variable: ip in on line 41
All the variable($ip
$uid
$pwd
) comes as undefined