Note that there are some explanatory texts on larger screens.

plurals
  1. POpreg_replace function set but not working
    primarykey
    data
    text
    <p>I GET IT WORKING, sorry guys...I should not put $_POST again inside the $stm</p> <p>The below code is where I received the posted value for security purpose, i plan to put preg_replace function..but it is not working?</p> <pre><code>&lt;?php if (isset($_POST['cartOutput'])) { $customer_name = preg_replace("/[^A-Za-z0-9 ]/", '', $_POST['customer_name']); </code></pre> <p>more code ...which might cause the problem? i checked my php it didn't filter</p> <pre><code>&lt;?php if (isset($_POST['cartOutput'])) { $customer_name = preg_replace('/[^A-Za-z0-9 ]/', '', $_POST['customer_name']); $tel_num = $_POST['tel_num']; $customer_address = $_POST['customer_address']; $error_status = false; if (empty($_POST['customer_name'])){ echo '&lt;a href="cart.php"&gt;Please Fill Your Name&lt;/a&gt;'; $error_status = true; } if (empty($_POST['tel_num'])){ echo '&lt;/br&gt;&lt;a href="cart.php"&gt;Please Fill Your Contact Number&lt;/a&gt;&lt;/br&gt;'; $error_status = true; } if (empty($_POST['customer_address'])){ echo'&lt;a href="cart.php"&gt;Please Fill Your Address&lt;/a&gt;&lt;/br&gt;'; $error_status = true; } if(!$error_status) { $sql= 'INSERT INTO orders (customer_name,tel_num,customer_address,product_name, price, quantity, date_added,customer_messages) VALUES(?,?,?,?,?,?,NOW(),?)'; $stmt = $myConnection-&gt;prepare($sql); $countArray = count($_POST["item_name"]); for ($i = 0; $i &lt; $countArray; $i++) { $stmt-&gt;bind_param('sssssss', $_POST['customer_name'],$_POST['tel_num'],$_POST['customer_address'], $_POST['item_name'][$i], $_POST['amount'][$i], $_POST['quantity'][$i],$_POST['customer_messages']); $stmt-&gt;execute(); } ; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload