We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

form-proccess.php problems

Development and Programming

denise@quaywestliving.co.uk's avatar
[email protected]
13 posts
14 years ago
denise@quaywestliving.co.uk's avatar [email protected]

I am running EE v 1.6.4

My site is www.quaywestliving.co.uk

I have a Wedding Gift List section in which I can create individual lists and add list items to it. The request for specific items and quantities are emailed to me (via the form-proccess.php as detailed below). All has worked fine in the past but a recent test revealed an anomaly: All received emails have correct details of List No, Dates, contact details etc but all state “The customer did not request a specific item.” Irrespective of quantities submitted?

Form Template and PHP file too much to show but relevant snippets below:

{if logged_in_member_id=="{wedding_user_test}"}
           <form id="wedding-form" action="/form-process.php" method="post">
           <h3 class="list-heading">List number   {list_no}:   {title}</h3>

           Ceremony date:   {wedding_date format="%D, %d %F %Y"}

           {wedding_list_desc}
           <input type="hidden" class="list-number" name="list-number" value="{list_no}" />
           <input type="hidden" class="list-name" name="list-name" value="{title}" />
           <input type="hidden" class="wedding-date" name="wedding-date" value="{wedding_date format="%d/%m/%Y"}" /><br >

<table id="wedding-list-table">
<tr>
    <th>Product image</th>
    <th>Item ref number</th>
    <th>Product name</th>
    <th>Description</th>
    <th>Price</th>
    <th>Qty requested</th>
    <th class="last">Qty to order</th>
</tr>

{related_entries id="list_items"}
<tr class="{switch='odd|even'}">
    <td>{if product_img}{product_img}{if:else}/images/uploads/not-available.jpg{/if}</td>
    <td>{title}</td>
    <td>{product_name}</td>
    <td>{wedding_item_desc}</td>
    <td>£{price}</td>
    <td>{quantity}</td>
    <td class="last"><input type="text" class="quantity" name="{title}-{product_name}-{wedding_item_desc}-quantity" value="0"></td>
</tr>
{/related_entries}

</table>

<label for="name">Your name:</label> <input type="text" name="name" id="name" /><br >
<label for="email">Email:</label> <input type="text" name="email" id="email" /><br >
<label for="telephone">Telephone:
</label> <input type="text" name="telephone" id="telephone" /><br >
(numbers only)

<input type="submit" value="Send" id="submit-btn" /></p>

<input type="hidden" value="/wedding-list/list/{segment_3}" name="web-address" id="web-address" />
</form>
{if:else}

{exp:member:login_form return="/wedding-list/list/{segment_3}"}
<h3 class="list-heading">You must login to see this page.</h3>
(all lowercase please)
<label>Username</label>

<input type="text" name="username" value="" maxlength="32" class="input" size="25" /></p>

<label>Password</label>

<input type="password" name="password" value="" maxlength="32" class="input" size="25" /></p>

<input type="submit" name="submit" value="Submit" /></p>

{/exp:member:login_form}
{/if}
<?php

$contact['name'] = strip_tags($_REQUEST['name']);
$contact['telephone'] = strip_tags($_REQUEST['telephone']);
$contact['email'] = strip_tags($_REQUEST['email']);

$list['no'] = strip_tags($_REQUEST['list-number']);
$list['name'] = strip_tags($_REQUEST['list-name']);
$list['date'] = strip_tags($_REQUEST['wedding-date']);

$back = strip_tags($_REQUEST['web-address']);

if(!isset($contact['name']) || $contact['name'] == ""){
    error("You didn't provide a contact name.", $back);
}
if(!isset($contact['telephone']) || $contact['name'] == ""){
    error("You forgot to gives us your phone number.", $back);
}
if(!isset($contact['email']) || $contact['name'] == ""){
    error("Could you tell us your email address?.", $back);
}

$pattern = "/^[a-zA-Z0-9._+-]+@[a-zA-Z0-9-.]+\.[a-zA-Z.]{2,10}$/";
if(!preg_match($pattern, $contact['email'])) {
    error("Looks like your email address has a mistake in it.", $back);            
}

$pattern = "/^\+?[()0-9\s]{10,20}$/";
if(!preg_match($pattern, $contact['telephone'])) {
    error("Your telephone number looks like it has a mistake in it.", $back);            
}

$message = "The following information was submitted to the wedding list form.\n";
$message .= "The wedding list in question is list number " . $list['no'] . " for the wedding of " . $list['name'] . " being held on " . $list['date'] . "\n";
$message .= "\n";

$message .= "The customer's contact details are:\n";
$message .= "Name: " . $contact['name'] . "\n";
$message .= "Telephone: " . $contact['telephone'] . "\n";
$message .= "Email: " . $contact['email'] . "\n";
$message .= "\n";

$message .= "The following were the requested items:\n";

$i = 0;

foreach ($_REQUEST as $key => $value) {
    if (strpos($key, "quantity") ) {
        $key = explode("-", $key);
        array_pop($key);
        $key = implode(" ", $key);
        
        if($value != 0){
            $message .= strip_tags(ucwords($key) . ": " . $value) . "\n";
            $i++;
        }
    }
}
if ($i == 0) {
    $message .= "The customer did not request a specific item.";
}


$to      = '[email protected]';
$subject = 'Wedding List Request -' . $list['no'] . " " . $list['name'];
$message = $message;
$headers = 'From: [email protected]';

mail($to, $subject, $message, $headers);
header("Location: http://quaywestliving.co.uk/?/wedding-gift-lists/thank-you/");

function error($error_message, $back){
?>

Any help would be gratefully received

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.