Jump to content

Submitted click, result infor on another php program.


johnseito

Recommended Posts

Hello,

 

Could someone show me a code example of when a user click on the submitted button on a form after filling it out, that all these information will be on another php program.

 

For example:

 

userinput.php (click submitted --- after filling the input field)

 

inputresult.php (show the result of the data filled in this page)

 

Thanks,

Here is an example

 

 

<?php



mysql_connect("localhost", "xxx", "xxx");//CONNECT TO MYSQL

mysql_select_db("test");  //SELECT DATABASE



$data = mysql_query("SELECT * FROM register");

// or die(mysql_error());

        



while($info = mysql_fetch_array( $data ))

{









  print <<<HERE

            <h1>Registered</h1>

<p>Thank you, you have registered - you may now login</a>.</p>



<table border=0>

<tr><td width=200><font color=black>First, Last Name: </font></td> 

<td><font color =gray> $info[firstname] ,$info[lastname] </font></td></tr><br>



    

<tr><td><font color=black>Gender: </font></td> 

  <td> <font color =gray>$info[gender] </font><BR></td></tr>





<tr><td><font color=black>Birthday: </font></td> 

<td><font color =gray>$info[month] $info[day] $info[year] </font></td><BR></tr>

     



HERE;
}



?>

 

 

userinput.php

Code:

 

<form method="POST" action="inputresult.php">

<input type="text" name="username">

<input type="password" name="password">

 

inputresult.php

Code:

 

<?php

print_r($_POST);

?>

 

dirty example, yes. but that will show you how it works.

 

This code looks good, but lets say for example, I only want to post what is filled when everything is filled(CONDITION) how

would I do that with this code then?

 

You know what I mean?

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.