Announcement

Collapse
No announcement yet.

php Price Match Form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    php Price Match Form

    Good Evening,

    I have just upgraded from V7 to V10 the website address is www.hartsofstur.com and wish to include a price match form that will collect the required information and e-mail it to sales@hartsofstur.com.

    I have used php embed in a fragment on a page called price_match_from.php and have used the following code below:

    !!<<actinic:block php="true" >
    <form method="post" action="price_match_response.php">
    <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td colspan="4"><h1><div align="center">Harts Of Stur Price Match</div></h1></td>
    </tr>
    <tr>
    <td colspan="4">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="4">
    <div class="fragmentbody"align="justify">Here at Harts Of Stur, we pride ourselves on our customer service and competitive pricing. Great as we are (well, we think so), we do not always know when our competitors offer special deals. Please ask us to price match on these occasions and if we can, we will!</div>&nbsp;
    </td>
    </tr>
    <tr>
    <td width="20%"><div class="fragmentbody" align="left"><strong>Name:</strong></div></td>
    <td colspan="3">
    <div align="left">
    <input name="name" type="text" id="name" size="50" maxlength="200">
    </div></td>
    </tr>

    <tr>
    <td><div class="fragmentbody" align="left"><strong>Telephone No: </strong></div></td>
    <td colspan="3">
    <div align="left">
    <input name="telephone" type="text" id="telephone" size="50" maxlength="200">
    </div></td>
    </tr>
    <tr>
    <td><div class="fragmentbody" align="left"><strong>E-Mail:</strong></div></td>
    <td colspan="3">
    <div align="left">
    <input name="email" type="text" id="email" size="50" maxlength="200">
    </div></td>
    </tr>
    <tr>
    <td><div class="fragmentbody" align="left"><strong>Product And Price To Match.<br/>(Including Delivery)</strong></div></td>
    <td colspan="3">
    <div align="left">
    <textarea name="message" cols="50" rows="4" id="message"></textarea>
    </div></td>
    </tr>
    <tr>
    <td><div class="fragmentbody" align="left"><strong>Company To Match And Website :</strong></div></td>
    <td colspan="3">
    <div align="left">
    <textarea name="address" cols="50" rows="4" id="address"></textarea>
    </div></td>
    </tr>
    <tr>
    <td><div align="left"></div></td>
    <td colspan="3">
    <div align="left">
    <input name="submit_button" type="submit" id="submit_button" value="Submit">
    <input type="reset" name="Reset" value="Reset">
    </div></td>
    </tr>
    </table>
    </form>
    </actinic:block>>!!


    The resulting page is price_match_response.php and conatins the following code embed in a fragment:

    !!<<actinic:block php="true" >
    <?php

    $name = $_POST['name'];
    $address = $_POST['address'];
    $telephone = $_POST['telephone'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $headers = "From: $email";


    // Validation
    if(3 < strlen($name) && 3 < strlen($email) && 3 < strlen($message))
    {

    $email_message = <<< EMAIL
    Message from websites Price Match form.

    Name: $name
    Telephone:$telephone
    Email:$email

    Product and Price:
    $message
    Company:$address
    EMAIL;

    if(mail('sales@hartsofstur.com', "Enquiry For Harts Of Stur" , $email_message, $headers))
    {
    echo "Thank you for your price match enquiry. We will deal with this as soon as possible and will contact you with our response";
    }
    else
    {
    echo "We had a problem sending the email.";
    }


    }
    else
    {
    echo "You did not fill in the form properly. Please use the browser's 'back' button and update the form.";
    }
    ?>
    </actinic:block>>!!


    Unfortunately when the website is loaded the following is only displayed on the page (please see http://www.hartsofstur.com/acatalog/...match_form.php)

    Parse error: parse error in main on line 2

    Any help on how to solve this or on a better way to achieve the aim will be greatly appreciated.
    www.hartsofstur.com - Seriously Good Cookware

    #2
    We use a form designer called 'Machform' that was recommended and discussed in this forum to produce a price match form and a form for taking requests for trade/wholesale quotes.

    See them in use here:
    http://www.golfteewarehouse.co.uk/ac...riceMatch.html
    and here:http://www.golfteewarehouse.co.uk/ac...radeQuote.html

    The price is currently £29 and is available form here: http://www.appnitro.com
    Darren Guppy
    Golf Tee Warehouse
    Golf Tees and Golf Accessories.

    Comment


      #3
      Cheers

      I will have a look tomorrow.

      Do you just use the code generated and embed it in fragment?
      www.hartsofstur.com - Seriously Good Cookware

      Comment


        #4
        Yes,

        I have a fragment containing the following code:

        Code:
        !!<
        <iframe height="820" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="http://www.mydomain.co.uk/machform/embed.php?id=1" title="Price Match Request"><a href="http://www.mydomain.co.uk/machform/view.php?id=1" title="Price Match Request">Price Match Request</a></iframe>
        >!!
        I believe you can either embed a PHP snippet into a fragment or the iframe like I used as I couldn't get the php code bit working so gave up and went for the iframe option instead.

        This thread is worth reading if tyring to implement it: http://community.actinic.com/showthread.php?t=38358
        Darren Guppy
        Golf Tee Warehouse
        Golf Tees and Golf Accessories.

        Comment


          #5
          Embedding the form is the best way for sure as it involves no updating of the code on the actinic side. You change it on machform itself and then the code you have added to actinic reads the form directly from within the machform architecture, so your website is always up to date instantly after a change within machform - fantastic service machform, one of the best things to have surfaced in the past 10 years IMO.

          Comment


            #6
            Graham, your original post #1 has:
            Code:
            !!<<actinic:block php="true" >
            <form method="post" action="price_match_response.php">
            .
            .
            </form>
            </actinic:block>>!!
            This is purely a lump of HTML but you are asking it to be interpreted as PHP code.

            Lose the <actinic:block php="true" > and </actinic:block>.

            And your second lump of code is meant to reside on your server. I'm not sure if this is an Actinic uploaded page (like you suggest) or a manually uploaded separate bit of code.

            If a separate bit of code, you've got spurious Actinic tags in it. Omit the first and last lines.

            If an Actinic generated page, lose the <actinic:block php="true" > and </actinic:block> but leave in the !!< and >!!.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thank you all for your help,

              I am currently settin up Machform.
              www.hartsofstur.com - Seriously Good Cookware

              Comment

              Working...
              X