Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Form to database empty delivery

Author  Topic 

Eugenef
Starting Member

2 Posts

Posted - 2013-10-01 : 07:56:13
Hi,

i have a form which delivers successful message on submit but database does not show any entries.any suggestion

My registration form
-------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simpla Admin</title>
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
<script type="text/javascript" src="resources/scripts/facebox.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.date.js"></script>
<link href="1-simple-calendar/tcal.css" type="text/css" rel="stylesheet">
<script src="1-simple-calendar/tcal.js" type="text/javascript"></script>
<script type="text/javascript">
function validateForm()
{

if (document.a.fname.value=="")
{
alert("Enter First Name")
document.a.fname.focus();
return false;
}
if (!isNaN(document.a.fname.value))
{
alert("First Name must be in Character form.");
document.a.fname.focus();
return false;
}

if (document.a.lname.value=="")
{
alert("Enter Last Name")
document.a.lname.focus();
return false;
}
if (!isNaN(document.a.lname.value))
{
alert("Last Name must be in Character form.");
document.a.lname.focus();
return false;
}

if (document.a.age.value=="")
{
alert("Enter Age")
document.a.age.focus();
return false;
}


if (document.a.mob1.value=="")
{
alert("Enter Mobile No")
document.a.mob1.focus();
return false;
}
if (isNaN(document.a.mob1.value))
{
alert("Mobile No must be in Numeric");
document.a.mobno.focus();
return false;
}
var l = document.a.mob1.value.length;
if(l!=10)
{
alert("Mobile No must be 10 Digit");
document.a.mob1.focus();
return false;
}

if (document.a.add.value=="")
{
alert("Enter Address")
document.a.add.focus();
return false;
}
if (document.a.emailid.value!="")
{
var x=document.forms["a"]["emailid"].value
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
document.a.emailid.focus();

return false;
}
}

var r=confirm("Are you sure you want to Add this Record ?");
if (r==true)
{
return true;
}
else
{
return false;
}
}

function toTitleCase(str)
{
var a=str.value;
//alert(str.name);
var k= a.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
document.getElementById(str.name).value=k;
}
</script>


</head>
<body onload="fnew()"><div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
<div id="sidebar">


<link type="text/css" rel="stylesheet" media="all" href="css/chat.css" />

<link type="text/css" rel="stylesheet" media="all" href="css/screen.css" />

<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="js/chat.js"></script>

<script type="text/javascript">

function fnew()

{

document.getElementById("psearch").focus();

}

</script>

<div id="sidebar-wrapper"> <!-- Sidebar with logo and menu -->



<h1 id="sidebar-title"><a href="#"></a></h1>



<!-- Logo (221px wide) -->

<a href="#"><img id="logo" src="resources/images/logo.png" alt="Admin logo" /></a>

<!-- Sidebar Profile links -->

<form name="frm" action="view1.php">

<table width="240" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="210"><div align="right" style="font-size:22px; color:#FFFFFF"><b>OPD Search</b></div></td>

<td width="30"><div align="right"></div></td>

</tr>

<tr>

<td align="right"> </td>

<td align="right"> </td>

</tr>

<tr>

<td align="right"><div align="right">

<input type="text" name="psearch" id="psearch" class="text-input" style="width:45mm;" />

</div></td>

<td align="right"><div align="right"></div></td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td><div align="right"></div></td>

<td><div align="right"></div></td>

</tr>

</table>

</form>





<div id="profile-links">



<a href="welcome.php" title="Sign Out" style="font-size:16px" ><b>Home ,</b></a>

<br />

<a href="sample.php" title="Chat">Chat</a>

<br/>

<a href="logout.php" title="Sign Out">Sign Out</a>

</div>



<ul id="main-nav"> <!-- Accordion Menu -->


<li>

<a href="#" class="nav-top-item "> <!-- Add the class "current" to current menu item -->

pod </a>

<ul>

<li><a href="new.php">New</a></li>

<li><a href="search.php">Search</a></li>

<li><a href="mob.php">New Mobile </a></li>

<li><a href="todayopd.php">Todays OPD</a></li>

<li><a href="todayapp.php">Todays Appointment</a></li>
</ul>

</li>

<li>
</div></div> <!-- End #sidebar -->

<div id="main-content"> <!-- Main Content Section with everything -->

<noscript> <!-- Show a notification if the user has disabled javascript -->
</noscript>

<!-- Page Head -->
<h2>Welcome </h2>

<div class="content-box-header">

<h3>New OPD </h3>
</div>
<div class="clear">
<form action="new_1.php" method="post" name="a" onsubmit="return validateForm();"><table width="102%" border="0">
<thead>
<tr>
<td>Customer Id </td>
<td><input type="text" name="cid" class="text-input" value="8696" readonly="true"/></td>
<td>Card</td>
<td><input type="text" name="ccode" class="text-input" value="8696"/></td>
<td> </td>
</tr>
<tr>

<td><span class="style5">First Name</span></td>

<td><input type="text" name="fname" id="fname" class="text-input" /></td>
<td><span class="style5">Last Name</span></td>

<td><input type="text" name="lname" id="lname" class="text-input" /></td>
<td> </td>
</tr>

<tr>

<td><span class="style5">Gender </span></td>

<td><select name="gen" >
<option value="Male">Male</option>
<option value="Female">Female</option>
</select></td>
<td>DOB</td>

<td><input type="text" name="dob" class="tcal" value="2013/09/19"/></td>
<td> </td>
</tr>

<tr>
<td>Age</td>
<td><input type="text" name="age" class="text-input" maxlength="3" /></td>
<td><span class="style5">Mobile</span></td>
<td><input type="text" name="mob1" class="text-input" maxlength="10" /></td>
<td> </td>
</tr>
<tr>
<td><span class="style5">Address</span></td>
<td><textarea name="add" style="height:22" ></textarea></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>City</td>
<td><span class="desc1">
<select name="city" style="width:36mm" >
<option>Select</option>
<option value=1>Bhopal </option><option value=2>Indore </option><option value=3>Pune </option><option value=4>Delhi </option><option value=5>Mumbai </option><option value=6>Bangalore </option><option value=7>Jhansi </option><option value=8>Jabalpur </option><option value=9>Gawalior </option><option value=10>Itarsi </option><option value=11>Vidisha </option><option value=12>Sehore </option><option value=13>Dewas </option><option value=14>Ujjain </option><option value=15>Nasik </option><option value=16>Raipur </option><option value=17>Bilaspur </option><option value=18>Bhilai </option><option value=19>Durg </option><option value=20>Raigarh </option><option value=21>Ambikapur </option><option value=22>Dhamtari </option><option value=23>Jagdalpur </option><option value=24>Korba </option><option value=25>Rajnandgaun </option> </select>
</span></td>
<td>Email Id </td>
<td><input type="text" name="emailid" class="text-input" /></td>
<td> </td>
</tr>
<tr>
<td>Card</td>
<td><select name="card" style="width:36mm" >
<option value="Silver">Silver</option>
<option value="Gold">Gold</option>
<option value="Platinum">Platinum</option>
<option value="Student">Student</option>
<option value="Employee">Employee</option>
</select></td>
<td>RefrenceId</td>
<td><input type="text" name="refno" class="text-input" value="0" /></td>
<td> </td>
</tr>
<tr>

<td width="139"> </td>

<td width="319"> </td>
<td width="214"><input class="button" type="submit" value="Submit" /></td>

<td width="281"> </td>
<td width="55"> </td>
</tr>
</thead>
</table>
</form>
</div> <!-- End .clear --><!-- End .content-box -->
<!-- End .content-box -->
<!-- End .content-box -->
<div class="clear"></div>



<div id="footer">
<small>
| <a href="#">Top</a>
</small>
</div>
<!-- End #footer -->

</div> <!-- End #main-content -->

</div></body>


</html>
--------------------------------
call in form
I have added data base to it below is excluding that line


<?php
$conn = mysql_connect("localhost","user","3");
$db = mysql_select_db(";;;;;;;;;;;",$conn);
?>
<?php

$CustomerID=$_POST[‘cid’];
$Card =$_POST[‘ccode’];
$FirstName=$_POST[‘FName’];
$LastName=$_POST[‘LName’];
$Gender=$_POST[‘Gen’];
$DOB=$_POST[‘DOB’];
$Age=$_POST[‘Age’];
$Mobile= $_POST[‘Mob1’];
$Address=$_POST[‘Add’];
$EmailId=$_POST[‘EmailId’];
$Card=$_POST[‘Cardtype’];
$RefrenceId=$_POST[‘Refno’];
$City=$_POST[‘City’];

$sql= "INSERT INTO opd
VALUES('$firstname','$lastname','$age','$CustomerId','$Card','$Gender','$DOB','$Mobile','$Address','$City','$Emailid','$Card','RefrenceId')";
///////////////////////////////////////
nefernandez2 at gmail

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-10-01 : 08:12:26
we are only on MS SQL Server here - sorry.

https://www.google.de/#q=getting%20help%20for%20php%20and%20mysql


Too old to Rock'n'Roll too young to die.
Go to Top of Page

Eugenef
Starting Member

2 Posts

Posted - 2013-10-01 : 08:14:37
ok.
Go to Top of Page
   

- Advertisement -