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">
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.