I told you that you'd have to be a lot more specific than that in the other forum where you posted it.
But, to answer your question the best I understand it, yes it's possible to do go to 2 pages with a page submission, but you have to do it sequentially. One browser window can only handle one page at a time.
The problem is if i put the php call in the href i got one new page (php) in the browser and after the htm page. Since i only wan't open the htm page the php it's only for email warning i couldn't applie your sugestion.
You can't call a PHP script without going to that as a page. You can redirect from that page if there isn't a problem, but you can't link to more than one page at a time. My choice would be to go to the PHP page, check for errors, then if there are none go on to the HTML page you want. If there are, then handle the error and do whatever you do then.
You have a couple of options, ones better than the others. As few have mentioned before me, the easiest option is:
1. initial .html page -> .php page -> final .html page
If that is all your php code, you can use header redirect after that and user will hardly notice they visited .php page.
2. initial .html page -> .php page
You can actually add all your content to the .php page. That way you are down to two pages. Just put that php call at the very top (it will send the mail) and continue outputting the html. Of course, the downside is that mail will be sent every time person reloads or visits that page from another source. You might validate that through referral, though that is not a reliable method.
3. initial .html -> .html page with an invisible (or marginally small) iframe that has the .php page in it.
This would be the closest to what you are looking for though it looks like some kind of virus application -- something goes on in the background you're not aware of. This solution has the same problems as the second, with mail being constantly sent.
All that said, the first option is still recommended.
The easiest way to do this is to include an image tag in your page with the href referring to your php program. After your php program sends the email, it outputs a 1x1 pixel invisible gif image. There is some code in the perl forum that you could adapt to do that.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
It's not overly complex at all, it's incredibly simple. All you need in your web page is an image tag that refers to your php program. It takes about 2 lines of code for the php program to return the gif image. You can find perl code I wrote to do that in the perl forum.
This technique has been used for MANY years (over 10 I believe) to allow web pages to gather hit counts and other stats.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.