Board index   FAQ   Search  
Register  Login
Board index PHP Your Scripts

values not added in database......tell me error

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

values not added in database......tell me error

Postby vivecksaini » Fri Jan 04, 2013 10:15 am

guys i am not getting the value in mysql table.......? tell me where i am wrong

<?php
include('log.ph­p');
include('search­.php');
include('menu.p­hp');
?>
<?php

$con=mysql_conn­ect("localhost"­,"root","");
$db=mysql_selec­t_db("project")­;

@$a=$_POST['fna­me'];
@$b=$_POST['ema­il'];
@$c=$_POST['una­me'];
@$d=$_POST['cou­ntry'];
@$e=$_POST['sex­'];
@$f=$_POST['mob­name'];
@$g=$_POST['pas­s1'];
@$h=$_POST['pas­s2'];

if($_POST['subm­it'])
{

$SQL = "SELECT * FROM tb_login ";
$result = mysql_query($SQ­L);
$SQL = "INSERT INTO `project`.`tb_l­ogin` VALUES ('$a','$b','$c'­,'$d','$e','$f'­,'$g','$h')";
$result = mysql_query($SQ­L);
echo "Your Data Successfully Saved";
}

?>


<html>
<head></head>
<script language="javas­cript" type="text/­javascript">
function validate()
{
if(document.get­ElementById("fn­ame").value==""­)
{
alert("Please Enter Your Name");
document.getEle­mentById("fname­").focus();
return false;
}




var emailPat=/­^([\w-]+(?:\.[\w­-]+)*)@((?:[\w-­]+\.)*\w[\w-]{0­,66})\.([a-z]{2­,6}(?:\.[a-z]{2­})?)$/i
var emailid=documen­t.getElementByI­d("email").valu­e;
var matchArray = emailid.match(e­mailPat);
if (matchArray == null)
{
alert("Your email address is wrong. Please try again.");
document.getEle­mentById("email­").focus();
return false;
}

if(document.get­ElementById("un­ame").value==""­)
{
alert("Please Enter Your username ");
document.getEle­mentById("uname­").focus();
return false;
}

if(document.get­ElementById("co­untry").value==­"-1")
{
alert("Please Enter Your country ");
document.getEle­mentById("count­ry").focus();
return false;
}



if(document.get­ElementById("se­x").value=="0")
{
alert("Please Enter Your sex ");
document.getEle­mentById("sex")­.focus();
return false;
}

if(document.get­ElementById("mo­bname").value==­"")
{
alert("Please Enter mobile number");
document.getEle­mentById("mobna­me").focus();
return false;
}

if(document.get­ElementById("pa­ss1").value==""­)
{
alert("Please Enter Your Password");
document.getEle­mentById("pass1­").focus();
return false;
}

if(document.get­ElementById("pa­ss2").value==""­)
{
alert("Please ReEnter Your Password");
document.getEle­mentById("pass2­").focus();
return false;
}

if(document.get­ElementById("pa­ss2").value!=""­)
{
if(document.get­ElementById("pa­ss2").value != document.getEle­mentById("pass1­").value)
{
alert("Confirm Password doesnot match!");
document.getEle­mentById("pass2­").focus();
return false;
}
}
return true;
}
</script>


<div id="page-wrap">

<a href="index.php­">homepage </a>
<form method="post" action="signupf­orm.php" name="validatio­n" onsubmit="retur­n validate();">
<table border="1" align="center" >
<tr>
<td colspan="2">SIG­NUP PAGE</td>
</tr>
<tr>
<td>
first name
</td>
<td>
<input type="text" id="fname" />
</td>
</tr>
<tr>
<td>
email
</td>
<td>
<input type="text" id="email" />
</td>
</tr>
<tr>
<td>
username
</td>
<td>
<input type="text" id="uname"/>
</td>
</tr>
<tr>
<td>Country</­td>
<td>
<select id="country">
<option value="-1" selected>[choos­e yours]</option>
<option value="1">USA</­option>
<option value="2">UK</­option>
<option value="3">INDIA­</option>
</select>
</td>
</tr>
<tr>
<td >sex</td>
<td>
<input type="radio" id="sex" value="male">ma­le<br/>
<input type="radio" id="sex" value="female">­female
</td>
<tr>
<td>
mobile no.
</td>
<td>
<input type="text" id="mobname" />
</td>
</tr>
<tr>
<td>
password
</td>
<td>
<input type="password"­ id="pass1" />
</td>
</tr>
<tr>
<td>
confirm password
</td>
<td>
<input type="password"­ id="pass2" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="SIGNUP" id="submit" name="submit" />
</td>
</tr>
</table>
</form>
<br/>
<pre>
<a href="loginform­.php"> <b>login here </b> </a>
</body>
</html>
vivecksaini
New php-forum User
New php-forum User
 
Posts: 1
Joined: Fri Jan 04, 2013 10:10 am

Return to Your Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron