Is anything wrong with this

They have: 105 posts

Joined: Jan 2002

Maybe I've just been looking at it too long...

The form
============

The Processor (PHP)
===================

<?
if($subemail=="") {
header ("Location: noemail.htm");
}
?>

This doesn't do the redirect if someone doesn't enter anything into the form. What's going on? It looks okay to me.

CPRhosting.com - CPR Hosting...Giving life to the web
Custom-made Hosting Plans starting at $2

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

try:

<?php
if($_POST['subemail']==\"\") {
header (\"Location: noemail.htm\");
}
?>

and don't forget to put quotes around method="POST" Laughing out loud

They have: 93 posts

Joined: Jun 2003

shanda: your method requires registered globals to be on if I am not mistaken. Renegade has given you the proper code and comment on the "post" thing.

HTML gets cranky if you are inconsistent, meaning you quote one attribute and don't on another.

If you can't get renegades to work

simple echo both values out and see if they contain something.

If not then that would equal "", but try NULL instead or even add an OR with NULL

[Design Alpha] -Web Services : Design,Hosting,Advertising,Software
Ask about custom pricing on hosting!!
Site Assets: [UltraGaming.com] [Blades of Warcraft]

They have: 105 posts

Joined: Jan 2002

Thanks for the help, and the heads-up on HTML's moodiness.

I modified the POST quotes Smiling, and I think that fixed it. Here's the final code.

The Form
==========

The Processor
=============
if (($_POST['subemail']=="") || ($_POST['subemail']==NULL))
{
header ("Location: noemail.htm");
}

else
{
echo "It works and my email is $subemail";
}

CPRhosting.com - CPR Hosting...Giving life to the web
Custom-made Hosting Plans starting at $2

They have: 93 posts

Joined: Jun 2003

Just a note. If the echo message works. Then Registered globals are one and you can do that $formfieldname stuff. However it is recommended by the PHP docs to use the $_POST['formfieldname'] method because if you ever switch servers,have that turned off on the server, or go to distribute the program it can cause problems. Plus it is a security risk.

The $formfieldname can be modified via a URL or "GET" form method.

using $POST[] ensures that the value come from a form "POST" method.

[Design Alpha] -Web Services : Design,Hosting,Advertising,Software
Ask about custom pricing on hosting!!
Site Assets: [UltraGaming.com] [Blades of Warcraft]

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.