I am trying to create a form like this:


<form name="registration1" action="registration2.php<?php //$_SERVER['PHP_SELF'] ?>" method="POST">

    <td>First Name</td>
    <td><input style="width: 500px;" type="text" name="fname" size="80px"><br><br></td>
    <td>Last Name</td>
    <td><input style="width: 500px;" type="text" name="lname" size="80px"><br><br></td>
    <td>Email Address</td>
    <td><input style="width: 500px;" type="text" name="email" size="80px"><br><br></td>
    <td>Phone No</td>
    <td><input style="width: 500px;" type="text" name="phone" size="80px"><br><br></td>
    <td><input style="width: 500px;" type="text" name="skype" size="80px"><br><br></td>
    <td><input type="checkbox" name="term" value="">I have read and understand the <a href="#">Terms & Conditions</a>


<?php include('includes/setting.php'); ?>                

<div class="buttons"><a class="button" data-type="register" onClick="window.location.href = '<?php SITEURL ?>registration2.php';">register</a></div><br><br>                         
<input type="submit" class="button" name="register" value="Simpan"> <!-- onClick="window.location.href = '<?php SITEURL ?>registration2.php';"/> -->


I already add registration2.php in action and I still wonder why after I click Simpan button why the page does not change to registration2.php

The url does only moves to: http://localhost/squprime/registration1.php?fname=&lname=&email=&phone=&skype=&register=Simpan

Attribute name="submit" always for submit button. And check your HTML syntax - where starts <table> ?

commented: The name attr for submit inputs can be anything. -1

You need to change the action value of you form.

action="<?php $_SERVER['PHP_SELF']; ?>/registration2.php"

commented: /registration2.php +0

The name attr can have any value. Does not have to be submit. @AndrisP is incorrect. name can = anything.. the type needs to = submit

Here is example for @AndrisP he is not sure about forms and php.

<form action="" method="POST" >
<input type="submit" name="anything" value="Submit" />


//Process the form

//dispay somthing else.


If you var_dump $_POST['anything'] you will get the value of Submit.


By the way, do not use $_SERVER['HTTP_HOST'] because it can be set by the client header request, it's not a value set by the server, so it can be dangerous. Bye!