Jump to content

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?

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.