[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

form button worked now it doesnt anymore

Posted on 2016-12-31
9
Medium Priority
?
124 Views
Last Modified: 2017-01-02
 <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>

Open in new window


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?
0
Comment
Question by:Jasmine Ikhreishi
  • 4
  • 4
9 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41943401
"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.
0
 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41943403
I dont have a live url yet so here is the link:
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>

Open in new window



Can you help me with what the issue is?
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41943411
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41943418
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.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41943429
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
0
 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41943432
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?
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 41943448
What do you mean an invalid markup?
Please click here to see what the validator shows:
https://validator.w3.org/nu/?doc=https%3A%2F%2Ficonoun.com%2Fdemo%2Ftemp_jasmine.php

There is nothing wrong with having two forms.  The problems are likely caused by some of the other things that the validator is calling out.  Until you've got a starting point with valid markup, it's not likely that you can get a predictable result from the controls on the web page. So my recommendation is to go through the W3 validator's output, correct the issues, then rerun the validator, correct any new or lingering issues, and repeat this process until you're getting a clean "bill of health" from the validator.  Once you've got that, it should be easy to use the controls to submit the form.
0
 
LVL 11

Expert Comment

by:Jeffrey Dake
ID: 41943452
I see you hav this script at the top.

    $('button').click(function(e) {
        e.preventDefault();
    });

Open in new window


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.
1
 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41944507
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?
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question