Jazzy 1012
asked on
form button worked now it doesnt anymore
<form method= "post" action= "edit.php">
<div class="panel-body">
<div class="row">
<div class="col-md-3 col-lg-3 " id= "show"> <img alt="User Pic" src= <?php echo "../profilepic/" .$path; ?> class="img-circle img-responsive">
<button class="btn btn-sm btn-info" id="opener"><i class="glyphicon glyphicon-edit"></i></button>
</div>
<div class=" col-md-9 col-lg-9 ">
<table class="table table-user-information">
<tbody>
<tr>
<td>First name:</td>
<td><span id= "keep"><?php echo $firstname;?></span><input id= "change" value= "<?php echo $firstname; ?>" style= "display:none;" name="name"></td>
</tr>
<tr>
<td>Last name:</td>
<td><span id= "keep5"><?php echo $lastname;?></span><input id= "change5" value= "<?php echo $lastname; ?>" style= "display:none;" name="lname"></td>
</tr>
<tr>
<td>Date of Birth</td>
<td><span id= "keep1"><?php echo $birthday; ?></span><input id= "change1" value= "<?php echo $birthday; ?>" style= "display:none;" name="bday"></td>
</tr>
<tr>
<tr>
<td>Gender</td>
<td><span id= "keep2"><?php echo $gender; ?></span><input id= "change2" value= "<?php echo $gender; ?>" style= "display:none;" name="gen"></td>
</tr>
<tr>
<td>Country</td>
<td><span id= "keep3">US</span><input id= "change3" value= "US" style= "display:none;" name="country"></td>
</tr>
<tr>
<td>Email</td>
<td><span id= "keep4"><a href="mailto:info@support.com"><?php echo $email; ?></a></span><input id= "change4" value= "<?php echo $email; ?>" style= "display:none;" name="mail"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel-footer">
<a data-original-title="Broadcast Message" data-toggle="tooltip" type="button" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-envelope"></i></a>
<span class="pull-right">
<a href="#" data-original-title="Edit this user" data-toggle="tooltip" type="button" class="btn btn-sm btn-warning" onclick = 'showMe()'><i class="glyphicon glyphicon-edit"></i></a>
<button data-original-title="Save this user" data-toggle="tooltip" type="submit" class="btn btn-sm btn-success" id="edit"><i class="glyphicon glyphicon-saved"></i></button>
</span>
</div>
</form>
I have this form, ad you can see it goes to edit.php when I click the save/submit button, it used to work, now it doesnt anymore Im not sure why, can anyone tell me what I am missing?
"Doesn't work" is not very descriptive. Please post a link to the web page that is failing so we can see the actual behaviors. Or if you don't have a live URL to demonstrate the issue, prepare the SSCCE so we can copy the code, install it on a public-facing server, and see the behaviors. Thanks.
ASKER
I dont have a live url yet so here is the link:
Can you help me with what the issue is?
require "connection.php";
$result= mysqli_query($conn,"SELECT * FROM users WHERE username = '$username'");
$row = mysqli_fetch_row($result);
$firstname = $row[0];
$lastname= $row[1];
$email = $row[2];
$birthday = $row[4];
$gender = $row[5];
$path = $row[8];
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Jasmine</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<style>
#header{
background-image: url("au.jpg") !important;
}
#three{
background-image: url("off1.jpg") !important;
}
button, input, select, textarea{
width:200px;
height: 20px;
}
#show {
position: relative;
float:left;
margin:5px;
}
#show:hover img{
opacity:0.5;
}
#show:hover button {
display: block;
font-size: 10px;
}
#show button {
position:absolute;
display:none;
}
#show button.btn {
top:0;
left:100;
}
.user-row {
margin-bottom: 14px;
}
.user-row:last-child {
margin-bottom: 0;
}
.dropdown-user {
margin: 13px 0;
padding: 5px;
height: 100%;
}
.table-user-information td {
min-width: 40%;
}
.table-user-information input {
border: 0;
}
#logout{
margin-left:600px;
padding-top:10px !important;
}
#edit{
width: 35px;
height:30px;
}
#opener{
width: 35px;
height:30px;
}
#images{
background: #E1E1E1;
margin-top:10px;
width:70px;
height: 30px;
}
</style>
<script>
$(document).ready(function() {
var panels = $('.user-infos');
var panelsButton = $('.dropdown-user');
panels.hide();
//Click dropdown
panelsButton.click(function() {
//get data-for attribute
var dataFor = $(this).attr('data-for');
var idFor = $(dataFor);
//current button
var currentButton = $(this);
idFor.slideToggle(400, function() {
//Completed slidetoggle
if(idFor.is(':visible'))
{
currentButton.html('<i class="glyphicon glyphicon-chevron-up text-muted"></i>');
}
else
{
currentButton.html('<i class="glyphicon glyphicon-chevron-down text-muted"></i>');
}
})
});
$('[data-toggle="tooltip"]').tooltip();
$('button').click(function(e) {
e.preventDefault();
});
});
</script>
<script>
function showMe(){
document.querySelector('#change').style.display = '';
document.querySelector('#keep').style.display = 'none'
document.querySelector('#change1').style.display = '';
document.querySelector('#keep1').style.display = 'none'
document.querySelector('#change2').style.display = '';
document.querySelector('#keep2').style.display = 'none'
document.querySelector('#change3').style.display = '';
document.querySelector('#keep3').style.display = 'none'
document.querySelector('#change4').style.display = '';
document.querySelector('#keep4').style.display = 'none'
document.querySelector('#change5').style.display = '';
document.querySelector('#keep5').style.display = 'none'
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#wrapper').dialog({
autoOpen: false,
title: 'Upload an image!'
});
$('#opener').click(function(e) {
e.preventDefault();
$('#wrapper').dialog('open');
});
});
</script>
</head>
<body id="top">
<!-- Header -->
<header id="header">
<div class="inner">
<img src="logo-small.png" alt="" />
<br></br>
<h1>Jasmine</h1>
</div>
</header>
<!-- Main -->
<div id="main">
<!-- One -->
<section id="one">
<div class="container">
<a href="logout.php" id ="logout">Logout</a>
<?php
if($_GET['a'])
{
echo '<p style= "color:red;"> Please select an appropriate image ';
}
?>
<div class="row">
<div class="col-md-5 toppad pull-left col-md-offset-3 ">
<br>
<br>
<!-- <p class=" text-info">May 05,2014,03:00 pm </p>-->
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title"><?php echo $firstname . " ". $lastname; ?></h3>
</div>
<form method= "post" action= "edit.php">
<div class="panel-body">
<div class="row">
<div class="col-md-3 col-lg-3 " id= "show"> <img alt="User Pic" src= <?php echo "../profilepic/" .$path; ?> class="img-circle img-responsive">
<button class="btn btn-sm btn-info" id="opener"><i class="glyphicon glyphicon-edit"></i></button>
</div>
<div class=" col-md-9 col-lg-9 ">
<table class="table table-user-information">
<tbody>
<tr>
<td>First name:</td>
<td><span id= "keep"><?php echo $firstname;?></span><input id= "change" value= "<?php echo $firstname; ?>" style= "display:none;" name="name"></td>
</tr>
<tr>
<td>Last name:</td>
<td><span id= "keep5"><?php echo $lastname;?></span><input id= "change5" value= "<?php echo $lastname; ?>" style= "display:none;" name="lname"></td>
</tr>
<tr>
<td>Date of Birth</td>
<td><span id= "keep1"><?php echo $birthday; ?></span><input id= "change1" value= "<?php echo $birthday; ?>" style= "display:none;" name="bday"></td>
</tr>
<tr>
<tr>
<td>Gender</td>
<td><span id= "keep2"><?php echo $gender; ?></span><input id= "change2" value= "<?php echo $gender; ?>" style= "display:none;" name="gen"></td>
</tr>
<tr>
<td>Country</td>
<td><span id= "keep3">US</span><input id= "change3" value= "US" style= "display:none;" name="country"></td>
</tr>
<tr>
<td>Email</td>
<td><span id= "keep4"><a href="mailto:info@support.com"><?php echo $email; ?></a></span><input id= "change4" value= "<?php echo $email; ?>" style= "display:none;" name="mail"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel-footer">
<a data-original-title="Broadcast Message" data-toggle="tooltip" type="button" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-envelope"></i></a>
<span class="pull-right">
<a href="#" data-original-title="Edit this user" data-toggle="tooltip" type="button" class="btn btn-sm btn-warning" onclick = 'showMe()'><i class="glyphicon glyphicon-edit"></i></a>
<button data-original-title="Save this user" data-toggle="tooltip" type="submit" class="btn btn-sm btn-success" id="edit"><i class="glyphicon glyphicon-saved"></i></button>
</span>
</div>
</form>
</div>
</div>
</div>
<div id="wrapper">
<form method="POST" action="getdata.php" enctype="multipart/form-data">
<input type="file" name="image">
<input id="images" type="submit" value="Upload">
</form>
</div>
</section>
Can you help me with what the issue is?
Does this start with an open-PHP tag that is missing? I copied it verbatim and installed it on my server here. What should it be doing?
https://iconoun.com/demo/temp_jasmine.php
https://iconoun.com/demo/temp_jasmine.php
ASKER
No no it isnt missing, most of not copied my mistake, yes that is how it is. As you can see it when you click the green "check" button it should go to edit.php but it isnt i dont know why it worked before.
There are two forms on the page. The first is on line 210. The second is on line 269.
The first form goes to edit.php. The second form goes to getdata.php.
The green check button appears on line 257.
It looks like the markup is not valid. It's almost impossible to get things to work right when you're starting with invalid markup. My recommendation would be to correct the validation errors, then try it again.
https://validator.w3.org/nu/?doc=https%3A%2F%2Ficonoun.com%2Fdemo%2Ftemp_jasmine.php
The first form goes to edit.php. The second form goes to getdata.php.
The green check button appears on line 257.
It looks like the markup is not valid. It's almost impossible to get things to work right when you're starting with invalid markup. My recommendation would be to correct the validation errors, then try it again.
https://validator.w3.org/nu/?doc=https%3A%2F%2Ficonoun.com%2Fdemo%2Ftemp_jasmine.php
ASKER
What do you mean an invalid markup? They are suppose to be two separate forms, is that not allowed and its right the form that starts at line 210 is for edit.php(and the green check ) and the one that is on line 269 is for getdata.php, how can i do to differentiate them and fix the issue?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I see you hav this script at the top.
Since this is on the click of any button on the page it will fire when you click the form submit button and prevent the form submission. Not sure what you were trying to do here, but hope this helps find your issue.
$('button').click(function(e) {
e.preventDefault();
});
Since this is on the click of any button on the page it will fire when you click the form submit button and prevent the form submission. Not sure what you were trying to do here, but hope this helps find your issue.
ASKER
No thats not the issue, it stopped working when I did the upload image form which is the second mini form as the bottom, is there any way to fix this?