Difference between revisions of "Web design FAQ"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) (etc) |
Karl Jones (Talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 20: | Line 20: | ||
* Redirect the user to YouTube using the [[PHP header|PHP header function]]. | * Redirect the user to YouTube using the [[PHP header|PHP header function]]. | ||
+ | |||
+ | The PHP script must not returned any content (that is, must not display any HTML or text). The header function will fail if the PHP script has already returned any content. | ||
+ | |||
+ | |||
+ | [[Category:Karl Jones]] | ||
+ | [[Category:Projects]] | ||
+ | [[Category:Web design]] | ||
+ | [[Category:Web design and development]] |
Latest revision as of 12:03, 21 April 2016
Questions I have received about web design, and my advice.
Tracking web form submittal
Question:
I have a client that wants to receive information from a form and when they click the submit button they want their viewer to be launched to a different site ... like a YouTube video.I am using a bootstrap form that captures info and sends it to site owner via email. The clients intent is to track those that go to the video.
The form I am using utilizes a JS to capture and a PHP to send the info to the client.
Answer:
The web form submits to a PHP script; the PHP script sends an email to the site owner.
In the PHP script, after sending the email, do the following:
- Log the user's visit: write a line to a log file, or add a record to a database, with the user's IP address and time of visit.
- Redirect the user to YouTube using the PHP header function.
The PHP script must not returned any content (that is, must not display any HTML or text). The header function will fail if the PHP script has already returned any content.