Jump to content

I can't change the value of a submit button and have a different post result?


moose-en-a-gant

Recommended Posts

I have a three part form, for creating a user, then I want to push a button that switches to a login without refreshing the page and log in.

 

The three parts are username, email, password

 

I push the login button instead of the create user button and this removes the email input

 

Now instead of the submit button displaying "Create User" it displays login,

 

 

I have two differnt action values in my php but when I hit the submit button, it only does the Create user action.

 

So is it not possible to do what I want?

 

Here are some parts of code that should surmize what I'm getting at.

 

I'll try to do it in the same order

if($_SERVER['REQUEST_METHOD']=='POST'){

if(empty($errors)){

if(isset($_POST['submit'])){
$action = $_POST['submit'];

if($action=='create user'){



}else if($action=='Login'){



}

}
}
<script>
$(document).ready(function(){

$("button").click(function(){

$("#div2").remove();

$("#div3").val("Login");

$("#btn1").remove();

});

});
</script>

<input type="submit" id="div3" name="submit" value="create user">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.