Hello…
Actually i have multiple forms on a single web page and i want to submit these forms for further processing into database, but unfortunately, the submit button of forms are not working…
I am using dreamwever and even dreamweaver editor is not showing any kind of error…
So could someone help me to resolve this…
Here is my PHP and HTML code…
[php] <?php include('config/setup.php'); ?>
<?php include('title.php'); ?> <?php include('header.php'); ?> $(document).ready(function() { $("#content div").hide(); // Initially hide all content $("#tabs li:first").attr("id","current"); // Activate first tab $("#content div:first").fadeIn(); // Show first tab content $('#tabs a').click(function(e) {
e.preventDefault();
$("#content div").hide(); //Hide all content
$("#tabs li").attr("id",""); //Reset id's
$(this).parent().attr("id","current"); // Activate this
$('#' + $(this).attr('title')).fadeIn(); // Show content for current tab
});
})();
</script>
</head>
<body id="subpage">
<div class="wrapper">
<div class="header">
<?php $page = 'eight';
include('menu.php');
$dbfname ='';
$dblname = '';
$dbusername ='';
$dbemail = '';
$dbcountry = '';
$dbtradingexperience='';
$dbbio ='';
$dbtradingstyle = '';
$dbmotto = '';
$dbavatar = '';
$error_status="";
if(isset($_SESSION['email']))
{
$q ="SELECT * FROM tbluserregistration WHERE email='$_SESSION[email]'";
$r = mysqli_query($dbc, $q);
$user = mysqli_fetch_assoc($r);
$dbfname = $user['fname'];
$dbcurrentpassword = $user['password'];
$dblname = $user['lname'];
$dbusername = $user['username'];
$dbemail = htmlentities($user['email']);
$dbcountry = $user['country'];
$dbtradingexperience = $user['experience'];
$dbbio = $user['bio'];
$dbtradingstyle = $user['tradingstyle'];
$dbmotto = $user['motto'];
$error_status= mysqli_error($dbc);
}
else
{
echo "<script type=\"text/javascript\">";
echo "alert('Please Login First!!')";
echo "</script>";
}
//echo "befor login check hello";
if(isset($_SESSION['email']) && isset($_POST['submit']))
{
if(isset($_POST['userprofile']))
{
//echo "tab1 is clicked!!";
//for storing the image into images folder
$email = htmlentities($_SESSION['email']);
$fname = htmlentities($_POST['firstname']);
$lname = htmlentities($_POST['lastname']);
$country = htmlentities($_POST['country']);
$tradingexperience = htmlentities($_POST['experience']);
$bio = htmlentities($_POST['bio']);
$tradingstyle = htmlentities($_POST['tradingstyle']);
$motto = htmlentities($_POST['motto']);
// name of the file
$pic = ($_FILES['photo']['name']);
$error_status ='Profile Update Success '.mysqli_error($dbc);
$target = "images/";
$target = $target . basename( $_FILES['photo']['name']);
$tab1query = "update tbluserregistration set fname='$fname', lname='$lname',
country='$country', experience ='$tradingexperience', bio ='$bio',
tradingstyle = '$tradingstyle' ,motto = '$motto', avatar = '$pic'
where email = '$email'";
$tab1fetch = mysqli_query($dbc,$tab1query);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
}
else
{
//Gives and error if its not
echo "Sorry, there was a problem uploading your file.";
}
if(!$tab1fetch )
{
die("Query is not being executed,so first check your mysql query");
}
echo "You have successfully updated your profile!!";
}
else if(isset($_POST['tab2']))
{
if(isset($_POST['passwordchange']))
{
echo "tab passwordchange is clicked!!";
$currentpassword = $_POST['currentpassword'];
$newpassword = $_POST['newpassword'];
$confirmpassword = $_POST['confirmpassword'];
if($dbcurrentpassword == $currentpassword)
{
if($newpassword==$confirmpassword)
{
$updatequery = "UPDATE tbluserregistration SET password='$newpassword'
WHERE email='$email'";
$row1 = mysqli_query($dbc,$updatequery);
if(!$row1 )
{
die("Query is not being executed,so first check your mysql query");
}
echo "<h1><style='color:white;'>Password is Updated Successfully!!</h1>";
}else
{
echo "NewPasword/ConfirmPassword Combination is Wrong";
}
}
else
{
echo "Check Your Current Password";
}
}
//echo "end of the password change tab";
}
}
else if(isset($_POST['emailchange']))
{
echo "tab emailchange is clicked!!";
$emailpassword = $_POST['emailpassword'];
$emailchange = $_POST['emailchange'];
if($dbcurrentpassword == $emailpassword)
{
$ecquery = "UPDATE tbluserregistration SET email='$emailchange' where email='$email'";
mysqli_query($dbc,$ecquery);
echo mysqli_error($dbc);
echo "<h1><style='color:white;'>Email is Updated Successfully!!</h1>";
//echo "befor tab3 button clicked";
}
else
{
echo "<h1><style='color:white;'>Current Password is Wrong!!</h1>";
}
}
else if(isset($_POST['accountpage']))
{
echo "tab3 is clicked!!";
$broker = $_POST['broker'];
$server = $_POST['server'];
$investerpassword = $_POST['investerpassword'];
$accountname = $_POST['accountname'];
$briefdescription = $_POST['briefdescription'];
$systemtype = $_POST['systemtype'];
$tradingtype = $_POST['tradingtype'];
$accounttype = $_POST['accounttype'];
$leveragetype = $_POST['leveragetype'];
$lastactivity = $_POST['lastactivity'];
$tab3query = "INSERT INTO tblaccount (company,server,investerpass,accountname,
briefdesc,systemtype,tradingtype,type,leverage,hislastupdate) VALUES
('$broker','$server', '$investerpassword','$accountname', '$briefdescription',
'$systemtype ','$tradingtype','$accounttype','$leveragetype','$lastactivity')";
$tab3fetch = mysqli_query($dbc,$tab3query);
echo mysqli_error($dbc);
//echo $tab3fetch ;
echo "Your Data is Saved Successfully!!";
}
?>
</div>
<div class="section">
<div class="logoposition subpagelogoposition">
<div class="logo"><a href="#"><img src="images/logo_1.png" /></a></div>
</div>
<div id="slider">
</div>
<div class="middlebanner"></div>
<div class="cleaner"></div>
<div class="container">
<div class="matter">
<h2><?php echo $error_status; ?></h2>
<div class="subpagescontent">
<div class="dashboard">
<h3>Settings</h3>
<div class="advancestatic">
<ul id="tabs">
<li><a href="#" style="font-size: 18px" title="tab1"> Profile </a></li>
<li><a href="#" style="font-size: 18px" title="tab2"> Password </a></li>
<li><a href="#" style="font-size: 18px" title="tab3"> Account </a></li>
</ul>
<div id="content">
Update Profile
Username: <?php echo $dbusername;?>
Email: <?php echo $dbemail;?>
First Name: Last name: Country: " > <?php if($dbcountry!="")echo $dbcountry; else echo 'Select country'?> Albania Algeria American-Samoa Trading Experience: " > <?php if($dbtradingexperience!="")echo $dbtradingexperience; else echo 'Select experience'?> Albania Algeria American-Samoa Bio : <?php echo $dbbio ?>[/php]