A fork in the validation road

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
virgil
Forum Commoner
Posts: 59
Joined: Thu Jun 13, 2002 11:43 pm
Location: New York, U.S.

A fork in the validation road

Post by virgil »

Hey PHP's :)

Does any one have any ideas on how to send a user to another page after the user input is validated and checks out?

I start with a logon form page (email and password fields) called logon.php.

I validate a form by sending the user input back to the top of the logon page and check the input with a reg. expression, is it in the data base etc.

If it fails, the logon form (which is just code lower on the same page) just displays again with an invalid email message or such.

If it passes, I want to send the user to a new page in the same window.

I tried changing the form attribute action="logon.php"

but if I use an IF statement to change the action "address" you have to resubmit the info again to go to the new page. (it takes a second pass to hit the now changed action "address")


I could open and close windows with java but I'm really trying to stick to PHP for a very reliable and error free site.

Anyway to do it with just php?

A click simulator would do the trick.
This site seems to use one when submitting posts.
Does PHP have one?

If not...
I think java has a click simulator event handler that could be used with an IF statement, but I have minimal java exp. Can it force a href url? How does it work? (a quick code snippet would be very helpful, if anyone has one handy).


Any Ideas?


Thanks very much all for the time and advice.

Virgil :)
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

if( email & password == valid){
header("Location: nextpage.php");exit;
}
Genteel Beaux
Forum Commoner
Posts: 28
Joined: Wed Nov 13, 2002 4:07 pm
Location: Alabama

Post by Genteel Beaux »

If has been my experience that

header("Location: whatever.php");
exit;

doesn't always work. Sometimes it works and other times I get sent to a blank screen.

Is there something else that works 100% of the time?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

yeah, give it full url, not a realative one. i believe the HTTP/1.1 spec requires it.
virgil
Forum Commoner
Posts: 59
Joined: Thu Jun 13, 2002 11:43 pm
Location: New York, U.S.

Post by virgil »

Thats it :D


Thanks PHPs...

I can't believe none of the php books I read ever mentioned it.

Are these the same "headers" that work with E-mail?

Ive been having some problems mailing to different E-mail services.

I tried to find a book on the ins and outs of E-mail headers but couldn't find one in the book store.

Does anyone know of a good one?

Online manuals are hard to read cover to cover.

I didnt even know a header function existed!

I'm workin like a Neanderthal over here!


Thanks....

Once again the PHPs (peeps)come thru!
Post Reply