Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

form button worked now it doesnt anymore

Posted on 2016-12-31
9
Medium Priority
?
118 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

647 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