Answer the question
In order to leave comments, you need to log in
How to remove the fields in the handler after submitting the form?
Hello. I use wicart for the site. After adding the product to the cart and clicking checkout, a form appears for filling in personal data. After sending data to the handler, it accepts hidden fields that are not needed. How to remove them?
<div id="order" class="popup">
<a href="#" class="close_popup" onclick="cart.closeWindow('order', 0)" style="position: absolute;margin: -25px 0px 0px 0px; right: 0;"><img src="images/close.png" /></a>
<div class="valid-text"></div>
<h4 style="text-align: center;">Введите ваши контактные данные</h4>
<form id="formToSend" onSubmit="cart.sendOrder('formToSend,overflw,bsum'); return(false);" >
<input id="fio" type="text" placeholder="Ваши фамилия и имя" required />
<input id="phoneNumber" type="text" placeholder="Контактный телефон" required class="text-input"/>
<input id="email" pattern="[a-z0-9._%+-][email protected][a-z0-9.-]+\.[a-z]{2,4}$" type="text" placeholder="Электронная почта" required />
<br>
<textarea id="question" placeholder="Адрес"></textarea>
<input type="hidden" class="valTrFal" value="valTrFal_disabled">
<input type="checkbox" id="checkBoxId" style="margin: 2px;">
<label for="agree-1" class="font-geometria-light">Нажимая на кнопку, вы даете <a href="policy.html" target="_blank">согласие на обработку персональных данных</a></label>
<input class="bbutton send" id="send" type="submit" disabled ></input>
</form>
</div>
<?
$mail = $_POST["order"];
$subject = "Заказ с сайта(".date("d.m.Y h:i").")";
$mail = strip_tags($mail, "<b><div><table><tbody><tr><td><html><body><style><h1><th><br>");
$mail = str_replace("<td></td>", "",$mail);
$mail = preg_replace('/<label[^>]*?>.*?<\/label>/i', '', $mail);
$mail = preg_replace('/<div[^>]+class="basket_num_buttons"[^>]*>.*?<\/div>/i', '', $mail);
$mail = preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', $mail);
$template = "<html>
<style>
*
{ font-family: Arial;}
table
{ border-collapse: collapse; }
td
{ padding: 5px; border: 1px solid #000;}
th
{
background: #999; padding: 5px;
}
</style>
<body>
<h1>".$subject."</h1>
".$mail."</body></html>";
$template .= '<hr>' . $_SERVER['HTTP_REFERER'];
// Clear form
$head = "<tr><th>Название</th><th>Цена</th><th>Кол-во</th><th>Всего</th></tr>";
$template = str_replace ( "<tbody>" ,"<tbody>".$head, $template);
$domain = "webinside.ru";
$from = "[email protected]". $domain;
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$success = mail("[email protected]", $subject, $template, $headers);
//echo ($success) ? 'true' : 'false';
if ($success == true)
{ echo "ok";}
else
{ echo "error";}
?>
<h1>Заказ с сайта Olaplex(13.03.2018 11:19)</h1>
<b>Ваши фамилия и имя</b><div>аукук</div>
<b>Контактный телефон</b><div>+7(333)333-33-33</div>
<b>Электронная почта</b><div>[email protected]</div>
<br>
<b>Адрес</b><div>2323</div>
<b></b><div>valTrFal_true</div> <-------------- Вот это нужно убрать
Нажимая на кнопку, вы даете согласие на обработку персональных данных <------- Вот это нужно убрать
Answer the question
In order to leave comments, you need to log in
after <?
$mail = $_POST["order"];
array_pop($mail);
array_pop($mail);
/* addition to g*code */
or
$mail = array_slice ($mail , 0, 4);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question