cant find what's wrng/cannot insert

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Mon Feb 24, 2014 10:19 am

cant find what's wrng/cannot insert

Postby roipatrick » Mon Feb 24, 2014 10:23 am

I need help in checking my code here. Im new to php and cannot insert into mysql using the data found inside text boxes.
<form class="form-input myprofile-form" action ="application.php" method="post" >
<div class="grid_9">
<div class="group-content form-accordion">
<!--tab 1 start-->
<div class="tab" id="tab1" style="height:400px; width:465px;">
<div class="form-fieldset">
<div class="fieldset-title">Main Information</div>
<div class="fieldset">
<div class="field">
<label>Start Date:</label>
<input type="date" id="datepicker" name='sdate' size='9' value="" />
<div class="field">
<label>End Date:</label>
<input type="date" id="datepicker" name='edate' size='9' value="" />
<div class="field">
<input type="text" size='9' name="remaining"/>
<div class="field">
<label>Leave Type</label>
<select class="custom-select" name="typeofleave">
<option>--Please Select Type--</option>
<option>Sick Leave</option>
<option>Emergency Leave</option>
<option>Paid Leave</option>
<option>UnPaid Leave</option>
<div class="field">
<input type="text" size='9' name="reason"/>
<div style="text-align:right;">
<input type="submit" />

<div class="clear"></div>
<!--tab 1 end-->


and here's my php code

if (isset($_POST["sdate"]) && isset($_POST["edate"]) && isset($_POST["remaining"]) && isset($_POST["reason"]))
$stratdate = $_POST["sdate"];
$endaten = $_POST["edate"];
$rem = $_POST["remaining"];
$res = $_POST["reason"];
// Check connection
if(! $con)
die('Connection Failed'.mysql_error());
$sql="INSERT INTO leaveinformation (sdate, edate, remaining, reason)
if (!mysql_query($sql,$con))
echo "Customer Details added Successfully!";

now if you will check, eveyrytime i submit the form (textboxes populated), i usually get the "salhdasjkhdjahskdhasjdhasdhjkd" after the die. It does not submit and i dont know why.

Please i need help asap. :help: :help: :help:

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests