Jump to content

Not Echoing Message? Help


jigsawsoul

Recommended Posts

It will not

 

echo 'Registration was successful';

 

but if the lines placed above

 

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

 

works fine

 

 

<?php

session_start();
ob_start();

include('../resources/config.php');
include($config["paths"]["resources"] . 'opendb.php');
include($config["paths"]["resources"] . '_library/login.php');

$_SESSION['message'] = "";
    if (empty($_POST['email'])) 
            $_SESSION['message'] .= "<li>A email address is required.<br /></li>";

    if (empty($_POST['password']))
            $_SESSION['message'] .= "<li>A password is required.<br /></li>";
            
    if ($_POST['password'] != $_POST['password2'])
            $_SESSION['message'] .= "<li>Passwords don't match<br /></li>";

    if (!empty($_SESSION['message'])) {
    		 $_SESSION['message'] .= "<br />";
             header("Location: register.php");
             exit();
    }

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

$result = mysql_query("SELECT email FROM projectlogin WHERE email = '$email'");
$emailcheck = mysql_num_rows($result) or die(mysql_error());

echo 'Registration was successful';

if($emailcheck > 0){
	$_SESSION["message"] = 
	   "<li>Email address already in use.<br /><br /></li>";
	header ('Location: register.php');
	exit;
}

echo 'Registration was successful';

include($config["paths"]["resources"] . 'closedb.php');

?>

 

Anyone see a problem or why this might be happening?

 

Link to comment
https://forums.phpfreaks.com/topic/196498-not-echoing-message-help/
Share on other sites

Adding this code doesn't do anything or display a problem anywhere? anyone have a better idea??? i really stuck :)

 

ini_set ("display_errors", "1"); 
error_reporting(E_ALL);

 

<?php
ini_set ("display_errors", "1"); 
error_reporting(E_ALL);


session_start();
ob_start();

include('../resources/config.php');
include($config["paths"]["resources"] . 'opendb.php');
include($config["paths"]["resources"] . '_library/login.php');

$_SESSION['message'] = "";
    if (empty($_POST['email'])) 
            $_SESSION['message'] .= "<li>A email address is required.<br /></li>";

    if (empty($_POST['password']))
            $_SESSION['message'] .= "<li>A password is required.<br /></li>";
            
    if ($_POST['password'] != $_POST['password2'])
            $_SESSION['message'] .= "<li>Passwords don't match<br /></li>";

    if (!empty($_SESSION['message'])) {
    		 $_SESSION['message'] .= "<br />";
             header("Location: register.php");
             exit();
    }

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

$result = mysql_query("SELECT email FROM projectlogin WHERE email = '$email'");
$emailcheck = mysql_num_rows($result) or die(mysql_error());

echo 'Registration was successful';

if($emailcheck > 0){
	$_SESSION["message"] = 
	   "<li>Email address already in use.<br /><br /></li>";
	header ('Location: register.php');
	exit;
}

echo 'Registration was successful';

include($config["paths"]["resources"] . 'closedb.php');

?>

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.