Jump to content

Alternative for die();


blink359

Recommended Posts

Hi i learnt today hard way that die(); can kill of loading the rest of your html page if you place it in the middle of your html after a few hours of trying to work out what was wrong and wondered what alternatives there are i have tried a few like "E_USER_ERROR" and "trigger_error" but none halt the script and display a message or do it without loading the rest of my page, There must be another way i just havent found it and would be really grateful if someone could tell me it.

 

Thanks,

 

Blink359

Link to comment
Share on other sites

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="main">
<!-- header begins -->
<div id="header">
<div id="logo">
</div>
    <div id="buttons">
        <ul>
          <li class="first">
  <a href="#"  title="">Home</a></li>
          <li><a href="#" title="">Calendar</a></li>
          <li><a href="#" title="">Gallery</a></li>
          <li><a href="#" title="">Events</a></li>
          <li><a href="#" title="">Flight Comp</a></li>
          <li><a href="#" title="">Login</a></li>
           <li><a href="#" title="">Contact Us</a></li>
          <li><a href="#" title="">261 Website</a></li>
        </ul>
    </div>
</div>
<!-- header ends -->
    <!-- content begins -->
    <div id="cont_top"></div>
    <div id="content">
        	<div id="left">
            	<h2>Contact Us</h2>
            	<div class="text">
<form action="contact.php" method="post">
   To:*<br>
    *****:<input type="radio" name="to" value="****" />******:<input type="radio" name="to" value="*****" />*****:<input type="radio" name="to" value="*****" />Webmaster:<input type="radio" name="to" value="webmaster" /><br>
    Your email:*<br>
    <input name="email" type="text"><br>
    Subject:*<br>
    <input name="subject" type="text"><br>
    Message:*<br>
    <textarea rows="5" cols="50" name="message"></textarea><br>
    <input type="submit" name="Submit" value="Send Email">
</form>

<?php
$to = $_POST['to'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

if(!$email || !$subject || !$to || !$message)
{
	die('Please fill in all required fields');
}
if($to = "*****")
{
	$to="";
}
if($to = "*******")
{
	$to="";
}
if($to = "******")
{
	$to="";
}
if($to = "*****")
{
	$to="";
}
if($to = "webmaster")
{
	$to="*********";
}


//Add their email at bottom of message
$message = $message."Reply to: $email";


mail($to, $subject, $message ,"From: $email nReply-To: $email"); 
echo "Email Sent";
?>
<br>
Click <a href="contact.html">here</a> to return to the previous page
<br></div>

                <div>
                	<h2>News!</h2>
                	<div id="col_l">
                        <div class="text">

                            <span>News item 1</span> <br />
			Text for news item 1<br />
                      </div>
                    </div>
                    <div id="col_r">
                    	<div class="text">

                            <span>News item 2</span> <br />
			Text for news item 2<br />
                      </div>
                    </div>
                </div>
            </div>
	<div id="right">
       	  <h1>Useful Links</h1>
          <ul>
<li>
          Mailing List<br>
</li>
<li>
  Nco Area
</li>

          </ul>
		<br />
      </div>
        	<div style="clear: both"><img src="images/spaser.gif" alt="" width="1" height="1" /></div>
    </div>
    <!-- content ends -->
    <div id="cont_bot"></div>
    <!-- footer begins -->
    <div id="footer">
  Copyright  2010. Designed by <a href="http://www.metamorphozis.com/" title="Flash Templates">Flash Templates</a><br />
	<a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a> | <a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a></div>
<!-- footer ends -->
</div>
</body>
</html>

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.