0

Hello,

I am trying to create a form like this:

registration1.php

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

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

</table>       

<?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';"/> -->

</form>

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

4
Contributors
5
Replies
33
Views
3 Years
Discussion Span
Last Post by cereal
-1

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

Edited by AndrisP

Votes + Comments
The name attr for submit inputs can be anything.
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

0

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

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


<?php


if(isset($_POST['anything'])){
//Process the form


}else{
//dispay somthing else.

}

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

Edited by gabrielcastillo: added var dump comment

0

@AndrisP

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.