Jump to content

Can anyone tell me why this isn't working?


Greaser9780

Recommended Posts

Here is the for that calls to bhdsingle_create.php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 

<html>

<head>

 

<title>Untitled</title>

 

</head>

 

<body>

 

<form action="bhdsingle_create.php" method="post">

Clan Name:<input type="text" name="clan_name">

Logo:<input ype="text" name="logo">

Message:<input type="text" name="message">

Email:<input tupe="text" name="email">

AIM Handle:<input type="text" name="aim">

Yahoo Handle:<input type="text" name="yahoo">

MSN Handle:<input type="text" name="msn">

<button type="submit">Submit</button>

</form>

 

</body>

</html>

 

 

 

 

 

Here is the php for bhdsingle_create.php:

<?php

session_start();

include('db.php');

array_pop($_POST);

if ( get_magic_quotes_gpc() ) {

    $_POST= array_map('stripslashes', $_POST);

}

$clan_name = mysql_real_escape_string(trim($_POST['clan_name']));

$logo = mysql_real_escape_string(trim($_POST['logo']));

$message = mysql_real_escape_string(trim($_POST['message']));

$email = mysql_real_escape_string(trim($_POST['email']));

$aim = mysql_real_escape_string(trim($_POST['aim']));

$yahoo = mysql_real_escape_string(trim($_POST['yahoo']));

$msn = mysql_real_escape_string(trim($_POST['msn']));

 

if ((!$clan_name) || (!$logo) || (!$message) || (!$email) || (!$aim) || (!$yahoo) || (!$msn)) {

    $message = "info";

    if (!$clan_name) {

      $error = "clan_name";

 

  }

  if (!$logo) {

      $error = "logo";

  }

  if (!$message) {

      $error = "message";

  }

  if (!$email) {

      $error = "email";

  }

  if (!$aim) {

      $error = "aim";

  }

  if (!$yahoo) {

      $error = "yahoo";

  }

  if (!$msn) {

      $error = "msn";

  }

  include("bhdsingle_join_form.html");

  exit;

}

 

$clan_name_sql = "SELECT COUNT(*) AS clan_name_match FROM `bhdsingle` WHERE `clan_name` ='$clan_name'";

$email_sql = "SELECT COUNT(*) AS email_match FROM `bhdsingle` WHERE `email` ='$email'";

 

$res= mysql_query($clan_name_sql) or die(mysql_error());

$result= mysql_query($email_sql) or die(mysql_error());

 

$clan_name_match= mysql_result($res, 0, 'clan_name_match');

$email_match= mysql_result($result, 0, 'email_match');

 

if (($clan_name_match > 0) || ($email_match > 0)) {

    if ($clan_name_match > 0 ) {

        $message = "clan_name_match";

        unset($clan_name);

echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.';

 

    }

    if ($email_match > 0) {

        $message = "email_match";

        unset($email);

echo 'Sorry, that Email is already registered to a clan. Please use another Email address.';

 

    }

    include("bhdsingle_join_form.html");

    exit;

}

 

$sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date)

        VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error());

 

if(!$sql){

    echo 'Det er kommet en fejl. Kontakt webmasteren';

} else {

    $clan_id = mysql_insert_id();

   

    echo 'Congratulations on registering your new clan for the BHD Singles Ladder!;

 

 

}

?>

 

 

 

 

Any help would be appreciated. TY in advance.

Link to comment
Share on other sites

I would first echo out each of the vars that you test with the if statements on the page directly and see what values are being stored in them.

 

Also what output are you expecting to see when you are getting a blank page?

 

As a debug step, put a an echo before, after and during the if statements to check what is happening during the execution of the if statements. something along the lines of

 


echo 'Start check of var 1';
if($varone <> 0)
{
  echo 'I am now inside the if statement checking var 1';
}
echo 'end of check of var 1';

Link to comment
Share on other sites

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.