AM26
AM26

Reputation: 251

Zebra Datepicker POSTING blank variable

I am implementing zebra datepicker.

On slecting the dates, the date is visible in the textfield but when I'm trying to retrieve the value by $_POST, the value is inserting in the database as blank.

Can you suggest me how to solve this.

My php code:

<?php
if(isset($_POST['sub']))
{
    include("connect.php");

    $ip=get_client_ip();
    $date=date("Y-m-d H:m:s");
    $dob=$_POST['dat'];//the zebra datepicker value
    ...
    insert code mysqli...
}
?>

The html datepicker field:

<h6 class="label">Date of Birth*</h6>
<div class="row">
    <div class="col-sm-3">
        <input type="text" name="dat" id="datepicker" placeholder="Date Of Birth" >
    </div>
</div>

The datepicker Js:

<script type="text/javascript">
$('#datepicker').Zebra_DatePicker();
</script>

Upvotes: 0

Views: 771

Answers (1)

Agha Umair Ahmed
Agha Umair Ahmed

Reputation: 1020

try this code

<?php 

if ( isset( $_POST['dat'] ) ) {
    print_r($_POST);
    exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="zebra_datepicker.js"></script>
</head>

<body>
<h6 class="label">Date of Birth*</h6>
<form method="post" >
<div class="row">
    <div class="col-sm-3">
        <input type="text" name="dat" id="datepicker" placeholder="Date Of Birth" >
    </div>
</div>
<input type="submit" />
</form>
<script type="text/javascript">
$('#datepicker').Zebra_DatePicker();
</script>
</body>
</html>

make sure your jquery path and your css path is absoultly write and check your console also

Upvotes: 1

Related Questions