Tracking goals when customers order services


(BK) #1

We use this form:

<form name="reservation" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>">
  <!-- Code for form input here-->		
  <button type="submit" value="Submit">Send</button>
</form>

When Submit button is pressed, PHP code runs on server and the page reloads itself in customers client browser.
PHP validate customers input. If validation is ok, PHP try to send the order email to us. If email is successfully sent, PHP set a variable = “The reservation is sent………”. Then the same page reloads with this text on top of the page.

Of course, if input validation fails, or email could not be sent, page reloads with errors.

Question: Is it possible to track goals based on URL and the text displayed on that page (“The reservation is sent………”)?

Any other suggestions will also be appreciated.


(BK) #2

I wonder, can I use PHP header() function to reload another web-page if validation is ok and email was successfully submitted? Something like this:

if ($emailOkMessage == "The reservation is submitted")
{
//  Redirect form to another page
header("Location:https://www.mywebpage.com/reservation-ok.html");
}