PDA

View Full Version : need help with IF condition


ukdeveloper
06-22-2012, 09:26 PM
I have a database which contains a list of random codes (which i outputted to csv and printed on keyrings).

I have with dreamweavers help managed to construct a form which asks for the code and then pulls the code from the database, alert user that it is NOT a winning code and then allows them to enter their name and email to be added for future draws.

This all works great (the code is here: http://pastebin.com/7AijWCQH)

What i need to do however is two things... firstly if someone enters a code which does not exist i need the form to go to a different web page and alert the user they have entered in the wrong code.

Secondly, if someone enters a CORRECT and fills in the form, i need the form to check the code and if an email exists go to another web page saying that this code is expired.

Sorry if this sounds a big ask but im real new to dreamweaver, so need all the help i can.

Regards

UKD

edbr
06-23-2012, 02:33 AM
you need something like

if($POST_['email']== $row ['email'])
{
header("Location: http://www.your domain.com/page.php");
} else
{
header("Location: http://www.your domain.com/page2.php");
}

ukdeveloper
06-23-2012, 10:07 AM
wow thanks edbr.

Even though this looks like a foreign language, i sort of get the idea.

2 q's:

1) where do I put this code relating to the code that put in pastebin because I only started in DW last month and my head is spinning about where to put code AFTER dreamweaver has inserted its own.

2). The most important thing is the checking the code physically exists and if not then print an error of some kind.

Many thanks again

UKD

edbr
06-25-2012, 02:46 AM
kinda tricky as what you post is the select statements, and as its dreamweaver muddle code im a bit reluctant to meddle.
however if it was put in a php block after the existing code you can try it and it is easily deleted if incorrect.
have a look at the Tizag.com examples for php it might help you