Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

67 users online



Need help with my code.

Need help with my code.

Currently viewing this thread: 1 (0 members and 1 guests)


JustEvolved

JustEvolved

Status: Offline!

Need help with my code.

I have this code below, i need the bottom part not to display if there are to conditions that apply.
1. the submit button was hit
2. there are no messages to display look at it I know i should use some is statements but I can't seem to get them to work. Any help would be great thanks.

PHP:

<?php 
include "header.php";
include(
"include/common.php");

if(
$_POST["submit"]){
    
field_validator("First Name"$_POST["first_name"], "alphanumeric"415);

    }
    if(empty(
$messages)) {
    
$sql2 "INSERT INTO customer (id, first_name) 
      VALUES (NULL, '$first_name')"
;

//start display
echo "Your information has been entered into the database.";

$query2 "SELECT id, first_name FROM customer WHERE id LIKE '$id'";
$result2 mysql_query($query2) or die("ERROR");
list(
$id$first_name) =  mysql_fetch_row($result2);

echo 
"$first_name";

//end display

    
}
}
?>
//*************************************************
// from here down should not display it the form was submitted and there are no messages to display.
//*************************************************
<TABLE width="540" BORDER="0">
<TR>
<TD align="CENTER" class="m">Signup To Become A Member</TD>
    </TR>
    <TR>
<TD>
<?php
if(!empty($messages)){ 
     
displayErrors($messages);
echo 
"<h4>Make sure Gender & Newsletter are selected.</h4><br><br>";
}else{
echo 
"<center><br><H1>Signup To Become A Member</H1><br></center><br> ";
}

$serverdate date("m-d-y");
?> 

  <table border="0" width="80%" cellpadding="0" cellspacing="0" align="center">
    <tr>
      <td>

         <FORM name="signup_cmo" ACTION="<? echo "$PHP_SELF"?>" METHOD=POST>
          <table border="0" cellpadding="0" cellspacing="0" width="91%">
            <tr>
              <td bordercolor="#000000">First Name:</td><td><?php print $_POST[""?>
              &nbsp;&nbsp;<input type="text" name="first_name" value="<?php print $_POST["first_name"?>" size="20" class="text"></td>
            </tr>
            <tr>
              <td><br><input type="submit" value="Submit" name="submit" color: #000000; border: 1 solid #000000" class="button"></td><td>
              &nbsp;&nbsp;<input type="reset" value="Reset" name="B2" color: #000000; border: 1 solid #000000" class="button"></td>
            </tr>
            <tr>
              </form></tr></table> </div></td> </tr></table> 

</td>
</tr>
</TABLE>
             </TD>
          </TR>
</TABLE></TD></TR></TABLE>
<?php include "footer.php"?>

___________________

We are survival machines - robot vehicles blindly programmed to preserve the selfish molecules known as genes.

- Richard Dawkins

ShaunTobias

ShaunTobias

Neversidian
Status: Offline!

have you tried

Code:


if (isset($_POST['submit'])) {

instead of

Code:


if($_POST["submit"]){

??

___________________

STphp - Modern Web Solutions - CLOSED
ShaunTobias.co.uk - Blog and Portfolio - CLOSED

Look out for LookCreative.co.uk in September.

Shinji1

Shinji1

computer-freak
Status: Offline!

hm, for the buttons use the $_REQUEST[''] variable, the $_POST are only for the form`s elements

___________________

http://www.animexclusive.com/forum_uploads/post-5-1072187870.jpg

JustEvolved

JustEvolved

Status: Offline!

The code works it's just that when you submit and it is successful it displays the bottom part again.

I need the bottom part of the code not to show up if the submit button was submitted and there are no messages. If there are messages to display then the bottom part is displayed, if the submit button was not hit then the bottom part is displayed.

___________________

We are survival machines - robot vehicles blindly programmed to preserve the selfish molecules known as genes.

- Richard Dawkins

ShaunTobias

ShaunTobias

Neversidian
Status: Offline!

maybe what you are looking for is exit(); ?

___________________

STphp - Modern Web Solutions - CLOSED
ShaunTobias.co.uk - Blog and Portfolio - CLOSED

Look out for LookCreative.co.uk in September.

JustEvolved

JustEvolved

Status: Offline!

Tried that if you use exit() it will stop the code in its tracks so if there are messages to be displayed then it wont display them because it exits.

___________________

We are survival machines - robot vehicles blindly programmed to preserve the selfish molecules known as genes.

- Richard Dawkins

epyon

epyon

16, staying Asian.
Status: Offline!
PHP:

<?
if(isset($_POST['submit'])) {
    
// do whatever here
} else {
    
// the bottom part
}
?>


note that i didn't look at your code.
(too long for me)

___________________

http://whatpulse.bounceme.net/sig/epyon.png

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0099 seconds.