Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Where can I find this songs real name

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > Internet Discussion
Register FAQ Community Calendar

HTML FORMS and PHP
Reply
 
Thread Tools
Old 22-10-2005, 23:30   #1
Tricky
Inactive
 
Tricky's Avatar
 
Join Date: Jun 2003
Location: I am house...
Services: $KY+HD - BT Infinity
Posts: 2,284
Tricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful one
HTML FORMS and PHP

I have a webpage mypage.htm that has a form which has it's action as "mypage.htm" I.e. Reloads itself with some posted values

I have some embedded PHP which check the fields are valid (email address, not blank etc) and if they are not shows an error against the invalid entries

An internal field "$allvalid" is 0 when all is ok and > 0 when errors are present

I want to redirect "mypage.htm" to some other page I.e. "success.htm" if $valid=0, I've tried the "Header: Location ..." but this won't work because I am already outputting data to screen

Any ideas?
Tricky is offline   Reply With Quote
Advertisement
Old 22-10-2005, 23:58   #2
Strzelecki
Inactive
 
Join Date: Jan 2004
Location: Essex
Age: 43
Services: 80/20Mbps FTTC on Freeola
Posts: 871
Strzelecki has reached the bronze age
Strzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze ageStrzelecki has reached the bronze age
Re: HTML FORMS and PHP

Best way is to use Javascript afterward, but you can work around in PHP like this:
PHP Code:
<?php
ob_start
();

// script with screen output

ob_end();
?>
Strzelecki is offline   Reply With Quote
Old 23-10-2005, 09:31   #3
BBKing
R.I.P.
 
BBKing's Avatar
 
Join Date: Jun 2003
Location: London
Services: 20Mb VM CM, Virgin TV
Posts: 5,983
BBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny star
BBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny star
Send a message via ICQ to BBKing
Re: HTML FORMS and PHP

Quote:
Any ideas?
Just done something similar - redirected to the same page with different parameters if a particular parameter was set. I use JSPs though, but the principle should be fairly similar - they don't allow you to redirect after you've done any output at all, so you must make your decision first, before outputting anything. This means using a separate pure PHP page as the target. Then, if you find all's well, redirect to success.htm, otherwise redirect to mypage.htm.

You could rewrite mypage.htm as php, but I don't totally approve of mixing content and programmatical data in the same file. Easier to debug if you keep it separate.
BBKing is offline   Reply With Quote
Old 23-10-2005, 20:40   #4
Tricky
Inactive
 
Tricky's Avatar
 
Join Date: Jun 2003
Location: I am house...
Services: $KY+HD - BT Infinity
Posts: 2,284
Tricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful oneTricky is the helpful one
Re: HTML FORMS and PHP

Sorted it, just do all the error checking and redirection before starting any output! (doh!)
I am too old for this stuff
Tricky is offline   Reply With Quote
Old 23-10-2005, 22:56   #5
BBKing
R.I.P.
 
BBKing's Avatar
 
Join Date: Jun 2003
Location: London
Services: 20Mb VM CM, Virgin TV
Posts: 5,983
BBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny star
BBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny starBBKing has a nice shiny star
Send a message via ICQ to BBKing
Re: HTML FORMS and PHP

That's the key - remember that once you start printing to browser, you can't stop. Like Pringles.

OK, that's the Guinness talking...
BBKing is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 22:05.


Server: lithium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum