Jump to content

Submit and send to another form


Jay2391

Recommended Posts

Here is my ???

 

I made a registration form and is ll okay and i can veryfy that information is not duplicated...

 

so in my code

 

$Problem = FALSE;

 

and i have all my variables set...

 

$name = John;

$last  = Doe;

 

ect...

 

So i want that when I hit submit is $Problem =False that i can send all my variables to a new page and diplay those ...

 

so I figure i can say

 

if $problem = false start a session but how do i send it to the next page  (register_handel.php)??? when i hit submit....

 

I try cleanning the code the best i could you may see thing that don't make sence but the explanation is the main idea of what i need to do

 

 


<?php
include("required.php");


$qr_id = "SELECT id FROM $tb_users ORDER BY id DESC LIMIT 1";
$res_id = mysql_query($qr_id, $tc);
$row_id = mysql_fetch_array( $res_id );
  	      
                  $id = $row_id['id'];
				  




ini_set ('display_error',1);
  error_reporting (E_ALL & ~E_NOTICE);
  define ('Title', 'Register');
print '<style type="text/css">
     <!-- .style10 {font-size: 20px; font-family: Verdana;} --> </style>'; 
  
print '<p><div align="left" class="style10"><font color="blue">Registration Form</font></div></p>';
print '<form action="md_reg.php" method="post">';


if ( isset ($_POST['submit'])){
    $problem = FALSE;



///////////////////////////PERSONAL INFORMATION/////////////////////////////   


   if (empty ($_POST['name'])){
	  $problem = TRUE;
	  $error_name = '<div align="left" class="style9"><font color="red">Please enter your "Name"</div>';	
	  echo "$error_name";		  
   }
   
   if (strlen ($_POST['name']) <=2){
	  $problem = TRUE;
	  $error_name_short = '<div align="left" class="style9"><font color="red">Name is too short!</div>';	
	  echo "$error_name_short";		  
   }
      
   if (empty ($_POST['email'])){
	  $problem = TRUE;
	  $error_email = '<div align="left" class="style9"><font color="red">Please enter your EMAIL</div>';	
	  echo "$error_email";		  
   }
   
   		 
/////////////////////////////////agreement//////////////////////////////////////////

       if ($_POST['agreement'] == 'No'){
          $problem = TRUE;
	  $error_agree = '<div align="left" class="style9"><font color="red">
	  "You did not read the rules or did not agree with the rules"</div>';	
	  echo "$error_agree";  
       }
	 	   	   
  }

echo "<br>";

print
    '<style type="text/css">
     <!-- .style9 {font-size: 9px; font-family: Verdana;} --> </style> 

 <style type="text/css">
     <!-- .style7 {font-size: 10px; font-family: Verdana;} --> </style>

    <table width="400" border="0" cellspacing="0" cellpadding="0"><tr>

<tr>
<th width="220" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="center" class="style9"><font color="red"> *** Required Information *** </font></div></th>
    </tr>

    <th width="80" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9">USER NAME:</div></th>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><input type="text" name="natgalid"
size"100" value="' . $_POST['natgalid'] . '"/></div></td>
<td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><font color="blue">create a user name</div></td>
    </tr>

 <th width="80" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9">NAME:</div></th>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><input type="text" name="name"
size"100" value="' . $_POST['name'] . '"/></div></td>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><font color="blue">enter your name</div></td>
    </tr>

    <th width="80" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9">EMAIL:</div></th>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><input type="text" name="email"
size"100" value="' . $_POST['email'] . '"/></div></td>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><font color="blue">enter your e-mail</div></td>	
    </tr>


<tr>
<th width="220" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="center" class="style9"><font color="red"> *** Agreement *** </font></div></th>
    </tr>

    <tr>
<th width="80" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9">Agreement:</div></th>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><select name="agreement"> 
    <option value="No">  I Do Not Agree     </option></p>
<option value="Yes">  I Agree      </option></p>
    </select></div></td>
    </tr>

    </table>';

print '<br><input type="submit" name="submit" size"20" value="Register!!"/><br /></h4>';

if ($problem == FALSE){
$name = $_POST['name'];
$email = $_POST['email'];
$pass = $_POST['pass'];      

}


?>

Link to comment
https://forums.phpfreaks.com/topic/71557-submit-and-send-to-another-form/
Share on other sites

So it is a two step submit? The user submits the first time and gets a confirmation page, then submits again to actually submit the info?

How many scripts are involved here? Is the one script to display and handle the first submit, then a second to handle the final submit?

 

When using sessions, you want to call session_start() before displaying anything, the session won't really do anything until you set a session variable with $_SESSION[].

right now my post handels goes to the same page and what i did is that if you submit and $problem= False then the information gets inserted.... now what i need is that if the information was inserted to send to a handel page that will display the content that was inserted.

 

 

Example:

 

Register here ....... information is okay.... insert and go to Handel page. this is my current comand for the submit that keeps yopu in the same page

 

print '<form action="md_reg.php" method="post">';

It sounds like you can simply provide a link to a page that displays the info.

So, after the insert is successful:

echo "<a href='display.php?id=".mysql_insert_id()."'>Link to display info</a>";

Then, in display.php you select the record by $_GET['id'] and display it.

 

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.