cereal 1,524 Nearly a Senior Poster Featured Poster

This is required by PHPMyAdmin when using the cookie authentication method. Install the php5-mcrypt package from apt and the error should disappear. More info about the extension here:

cereal 1,524 Nearly a Senior Poster Featured Poster

I don't know, this is my test, based on your code:

click on Run to execute the page. It seems to resizes fine for me, but I'm not testing IE right now, so I'm not sure I suggested you something wrong. The only differences are:

  1. I'm loading Bootstrap and JQuery from CDN
  2. I'm not loading custom styles
  3. I replaced navigation and footer with simple divs

So it could be a broken end tag or something else. If it still does not help wait for other suggestions.

cereal 1,524 Nearly a Senior Poster Featured Poster

Add this line after the init function:

google.maps.event.trigger(map, 'resize');

Then change the #map width to 100% and the height according to the resolution, in this case you can use media queries, for example:

@media (max-width: 599px) {
    #map {
        height: 350px;
        width: 100%;
    }
}

@media (min-width: 600px) {
    #map {
        height: 450px;
        width: 100%;
    }
}

Reference:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, read this guide:

In particular follow the instructions for Ubuntu 13.10+, you have to include the configuration file into the server, the guide refers to Apache.

Anyway, I prefer to install it directly from source, to get the latest version. Just uncrompress to a directory in /var/www/, assign a local domain (for example phpmyadmin.sql) and follow the setup guide from PHPMyAdmin.

cereal 1,524 Nearly a Senior Poster Featured Poster

I don't know the contents of the included files, but have you included the link to the API?

<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script>
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

by default the composer autoload is set to FALSE. So open /application/config/config.php and replace this:

$config['composer_autoload'] = FALSE;

With:

$config['composer_autoload'] = FCPATH . 'vendor/autoload.php';

FCPATH is defined in the root index.php file, if the vendor directory is at the same level, then it should work fine, otherwise define the absolute path to the autoload file.

Now, I have not tested the Facebook SDK with CI3, so I'm not sure this will solve your issue. If problem persist then show us the error codes.

cereal 1,524 Nearly a Senior Poster Featured Poster

It does not work because you are trying to style an external link loaded by the iframe tag.

So, remove this:

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d97183.46594409156!2d-79.98050049999999!3d40.431368449999994!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8834f16f48068503%3A0x8df915a15aa21b34!2sPittsburgh%2C+PA%2C+USA!5e0!3m2!1sen!2sid!4v1438937398399" width="1000" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

Replace it with:

<div id="map"></div>

And apply CSS rules to #map, from there you can define the size of the map, for example:

#map {
    height:450px;
    width:1000px;
}
cereal 1,524 Nearly a Senior Poster Featured Poster

If you refer to filtering:

Protection against XSS attacks needs to be done on the server since if you can submit contents in a form using TinyMCE one could as easily disable all javascript and there for bypass TinyMCE filtering and still submit HTML code with insecure content. You need to properly filter the HTML input on the server using things like HTMLPurifier etc.

But even if you use the bundled filtering, this is limited to the textarea, not to other input fields.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have defined the init function and the array, but you are not applying the array to the map, so change this:

function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 8
  });
}

To:

function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 8
  });
  map.setOptions({styles: styleArray});
}

And it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster
pritaeas commented: ROFL +14
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, it's a WYSIWYG text editor for HTML pages: http://www.tinymce.com/

cereal 1,524 Nearly a Senior Poster Featured Poster

Also: what kind of column type are you using for SaleDate? Is this column nullable? You could see a performance difference if using date, datetime or varchar and by setting it to not null, for example:

CREATE INDEX sales ON Master(SaleDate);

-- on
CREATE TABLE `Master` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `product` text NOT NULL,
  `price` varchar(100) NOT NULL,
  `saled_at` datetime NOT NULL, -- format YYYY-mm-dd H:i:s
  `SaleDate` date NOT NULL,     -- format YYYY-mm-dd
  PRIMARY KEY (`id`)
) ENGINE=MyISAM;

I made few tests with datetime and date, and also a previous test with varchar, and by using the date type, with NOT NULL and with an index, it should speed up a bit.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

first problem is CURDATE(), the query won't be cached, you could try to send this date from PHP and see if it improves the execution, at least you should see a difference when the query is repeated on the same range.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

what are the requirements? Is this for a carrier or for a shop?

For example: in the second case you will need few tables in which you can record the tracking id, the carrier details and each step of the shipment process, most of this information can be retrieved by the carriers APIs, when available. It happens sometimes that a carrier delivers through another one, for example UPS does not deliver everywhere and sometimes uses local carriers, so the same shipment can assume multiple tracking ids: recording an event like this implies a different approach if the application is for a carrier or for a shop, where a shop may not need all the details.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you probably have to use their API, I'm not sure you can use the JavaScript SDK for this task, maybe you will need the PHP SDK, here are the links to the documentation:

cereal 1,524 Nearly a Senior Poster Featured Poster

An hook is a technique to extend or modify the behaviour of an event in a program. A webhook is the same but related to web events.

A callback url is part of a webhook: it's used to allow a remote server to send an asynchronous response to a previuos request or simply to send data to your server.

In practice you are allowing a remote server (SendGrid) to perform a POST request to your server and let you receive incoming emails. To very simplify the flow it's like pointing a form to a script:

<form method="post" action="/path/to/script.php">

The only differences are that:

  1. the action is defined in the SendGrid interface and not into your website;
  2. and the path will include your domain: http://website.tld/path/to/script.php

Note that SendGrid requires also that you fix your MX record, as explained in the first link.

The content of the callback file (script.php) will be the same that you would write for a form used in your website, for example:

<?php

    if($_POST)
    {
        # code here
    }

The request body received by $_POST will be composed by the keywords defined in the setup table:

So: $_POST['headers'], $_POST['text'], $_POST['html'], $_POST['from'] and so on.

Hope it helped you to understand it better, otherwise ask to SendGrid support or wait for other replies. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi!

Bit border line, but I suggest you to learn also how to build raw HTTP requests and parse responses to understand: how to deal with RESTful APIs, how to build them, how mails are sent, how (chunked) uploads are performed and in general how socket programming and web servers work.

These are tasks that can be performed with a telnet client. In PHP there are many functions and libraries that simplify it, but by understanding what's going it will help you a lot.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

to hide an input field use type="hidden":

<input type="hidden" name="from[]">

Now, $_POST['from'] will be an array, if value is not assigned, then it will be an empty array, for example:

Array
(
    [origin] => Array
        (
            [0] => 
        )

    [other] => hey
)

So, if you have a problem with it, how are you trying to access his values? You cannot directly echo an array, you can implode it to a string, use serialization, or json encode, or you can loop it to read each single value. This can help you:

And if you're still in doubts, share the code that does not work.

cereal 1,524 Nearly a Senior Poster Featured Poster

@broj1

Hi, I've seen that in Magento, for internationalization, it's a refer to gettext _():

cereal 1,524 Nearly a Senior Poster Featured Poster

Obtain from where: database, form? Which formula would you apply?

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

in pratice apt does not resolve that repository, you can change it, read these links:

In practice you can set http://httpredir.debian.org/debian and let the server choose the best mirror, or you can manually define which mirrors you want to use.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have to set a callback URL to receive the POST requests, from Parse API documentation:

The Parse API will POST the parsed email to a URL that you specify. If a POST is unsuccessful, SendGrid automatically queues and retries any POSTs that respond with a 4XX or 5XX status. This prevents data loss for customers who have misconfigured their website or POST URL.

More here:

cereal 1,524 Nearly a Senior Poster Featured Poster

It's fine for me on Google Chrome, Ubuntu:

Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36
cereal 1,524 Nearly a Senior Poster Featured Poster

@wawammm

Hi!

For what I have read about directadmin, it will set a normal cronjob, so if I correctly interpreted the question yes, I think my reply answers to his question: in the first case the example timeouts after 1 second, in the second case it will timeout after the system call completes, due to the usage of sleep, however, it will not end, but this is just an example.

i think he means is there a difference between http (browser) requests and cronjobs regarind max_execution_time?

There can be a difference: each SAPI has a different configuration file (the php.ini). The SAPI is the interface used to serve PHP, which in case of cronjobs is CLI (Command Line Interpreter), which is also the same environment used when you run a script from a terminal.

A cronjob, usually, does not involve a browser, but a simple script ran from a CLI environment, with the above code you can test how a system call affects the script. The system sleep command can be replaced with whatever task you prefer: like downloading a big file or something else.

The difference comes in when PHP is on a Windows server: in this case the system call will be included in the maximum execution time and can timeout easily.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hello,

move the </body> tag to the end of the page, just before the </html> tag. An HTML document is composed two main sections, head and body:

<html>

    <head>
        <title>Test</title>
    </head>

    <body>

        <!-- content area -->

        <h1>Hello</h1>
        <p>Bla bla bla</p>

        <!-- end of content area -->


        <!--
            Area where to start scripts
            that can to be loaded after
            page content is loaded, the
            equivalent of $(document).ready()
            in jQuery.
        -->
        <script>
            ...
        </script>
        <!-- end of javascript area -->

    </body>

</html>

The head section is used to define the document type, encoding and the resources to load such as scripts, fonts and styles possibly before rendering the content of the body section. Whatever you don't code inside the head section must to be placed in the body section. You must not write code outsite of these boundaries.

cereal 1,524 Nearly a Senior Poster Featured Poster

In addition, you could use document.createTextNode():

$('form').on('change', function (e) {
    var text = $('#bla').val();
    $('#cnt').append(document.createTextNode(text));
});

Example: http://jsfiddle.net/u6pqhjzy/
Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

it depends on the OS: on Windows the measured time is the real time; on Linux system calls do not affect the execution time. Read the note at this page:

You can test it by yourself:

<?php

    ini_set('max_execution_time', 1);

    while(true)
        echo 'hi ' . date('H:i:s') . PHP_EOL;

And:

<?php

    ini_set('max_execution_time', 1);

    while(true)
    {
        system('sleep 3');
        echo 'hi ' . date('H:i:s') . PHP_EOL;
    }

And then run:

time php script.php

In the first case at the end of the execution you will see something like:

Fatal error: Maximum execution time of 1 second exceeded in script.php on line 6

real    0m1.224s
user    0m0.712s
sys 0m0.224s

In the second case you have to hit CTRL + C, otherwise it will never end. The sleep() function will act as the system call.

cereal 1,524 Nearly a Senior Poster Featured Poster

@Keimpe

Hi! You're correct about the select statement, however the original query is performing a bitwise xor between values in table and the submitted input, then the result is read by BIT_COUNT() and compared through >= which is not a limit clause.

So, if my interpretation of the OP request is correct, my previous query should work.

Live example: http://sqlfiddle.com/#!9/233e97/1

Docs about bit count: https://dev.mysql.com/doc/refman/5.7/en/bit-functions.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, now don't forget to apply an .htaccess rule to avoid remote downloads of the sqlite file:

<FilesMatch ".+\.(db|sqlite)$">
Order Deny, Allow
Deny from all
</FilesMatch>

This will match any file with extension .db or .sqlite and deny remote access.

Docs:

Then, if we are finished, please mark the thread as solved. Bye! :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

starting from PHP 5.3, SQLite3 is enabled by default, this would allow you to create an sqlite file and connect to it:

In both cases it requires that on compilation the hosting didn't disabled the support. Looking at phpinfo() you should be able to find if is supported or not.

Before implementing SQLite read these pages carefully:

Otherwise, if allowed, use an external database service.

cereal 1,524 Nearly a Senior Poster Featured Poster

so we can use RowID for uniquely identifying the records right ?

Depends how much uniqueness needs to be extended: on SQLite it will be unique over the table, in Oracle it will be unique over the database and in PostgreSQL is not encouraged because:

The oid type is currently implemented as an unsigned four-byte integer. Therefore, it is not large enough to provide database-wide uniqueness in large databases, or even in large individual tables. So, using a user-created table's OID column as a primary key is discouraged. OIDs are best used only for references to system tables.

You wrote:

Can we use indexes instead of using keys for identifying unique records

An index can be defined by a primary key or by a unique key, both can be based by single or multiple columns. So no, at least at my knowledge and in reference to MySQL, you cannot define an index without defining which keys will be part of it.

or can declare trigger for each unique record?

A possible but expensive task, at least in MySQL, because it would require a full scan of the table each time you need to insert or update something. An index will speed up most of these operations.

cereal 1,524 Nearly a Senior Poster Featured Poster

Interviewer said you need not to use any key in the table either that is a unique key or any natural key.

So nothing explicitly defined in the creation table statement, correct?

Maybe the question refers to implict keys like ROWID (available on Oracle & SQLite), or OIDs (Object Identifier in PostgreSQL) which are set by default by the database. However these are not available in all databases, like for example in MySQL.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you mean how to add conditional statements to a loop? For example:

var test = 'oranges';

['apples', 'oranges', 'mango'].forEach(function (elem, index) {

    // conditional statement
    if (elem == 'oranges') {
        console.log('Chosen element: ' + elem);
    }

    // default condition
    else {
        console.log('Something else.');
    }
});

Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

on terminal write hp- then hit tab, you should see:

hp-align               hp-info                hp-query
hp-check               hp-levels              hp-scan
hp-clean               hp-logcapture          hp-setup
hp-colorcal            hp-makeuri             hp-testpage
hp-config_usb_printer  hp-pkservice           hp-timedate
hp-doctor              hp-plugin              hp-unload
hp-firmware            hp-plugin-ubuntu       
hp-hpdio               hp-probe        

Which are the utils installed by the hplip package, among them there is also the command hp-scan but you need to setup the printer, so try hp-info to see if it's detected... you can also install the GUI, package name is hplip-gui.

cereal 1,524 Nearly a Senior Poster Featured Poster

The error is generated by line 15:

 [5] //$img = $session_data['profile_picture'];
     ...
[15] $data['profile_picture']=array('profile_picture'=>$img);

You're using an undefined variable $img, which is commented at line 5.

cereal 1,524 Nearly a Senior Poster Featured Poster

No, it shouldn't happen, check the database error log to find some information:

It can happen if the database executable (mysqld) is killed while writing data to a table or for an unexpected shutdown of the computer. However there are many things to consider depending on the used engine, here are few links to InnoDB and MyISAM but you should check the documentation for each specific engine in use:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, the overview explains that there are two methods to load these styles.

In the first case you can change the default style by assigning the array to the MapOptions object:

map.setOptions({styles: styleArray});

Documentation for the first method:

The second method uses the StyledMapType class and requires few steps:

var styledMap = new google.maps.StyledMapType(styleArray,
{name: "Styled Map"});
...
map.mapTypes.set('map_style', styledMap);

Documentation for the second method:

Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, check the W3C Validator: https://validator.w3.org/

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you can use IMAP to access the ticket@domainname.tld account, then update a database table in which you save the ticket number: http://php.net/manual/en/book.imap.php

If you also need to parse the message use Mailparse: http://www.php.net/manual/en/book.mailparse.php

Note: you have to compile PHP with IMAP support, or if in Debian & co. install the php5-imap package. Mailparse instead is a PECL package.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

the error states that the included file is not found in the current path, I see your index.php is under /homessd/ while you're trying to include startup.php from /home/, so change it to /homessd/ and it should work fine.

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm not sure I've understood the problem and the request.

it won't work when i have time more than 2 hours

So if you do:

$next_program_times = $program_times + 3;

It will give problems? Or you refer to multiple program_times?

when i try this:

$next_program_times = '<span id="time', $show_id + 1, $program_times,;

it don't work

I see few problems here:

  1. if you end the string with a comma you will generate a parsing error for unexpected ;
  2. you can use commas to separate variables and strings when outputting the variables and strings but not to assign them to a variable, so change the above to:

    $next_program_times = '<span id="time' . $show_id + 1 . $program_times;
    

    But if you add an integer to the string you loose the <span tag and end with something that looks like 110:00 AM. So something more correct is:

    $abc = $show_id + 1;
    $next_program_times = '<span id="time' . $abc . $program_times;
    

    This will generate something like <span id="time11410:00 AM which is still wrong, as an id cannot contain a space character.

  3. I don't know how you set $show_id but I assume this is set outside the loop, so there are good chances that it will generate a group of same ids at least as in your original code that does not include the $program_times variable. An id attribute in HTML must be unique over the document, if you don't fix it you can encounter problems with javascript …

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, the issue is at line 12:

$next_program_times = $program_times + 1;

If $program_times has value of 3:00 PM which is a string and you add an integer, you get only 4, so PM does not exists anymore, nor the formatting. To keep the current format, instead, you have to use the DateInterval class, as done on line 9:

$next_program_times = (new Datetime($program_times))->add(new DateInterval('PT1H'))->format('g:i A');

Which will output 4:00 PM.

cereal 1,524 Nearly a Senior Poster Featured Poster

The engraving does not arrive because it is not included in the form used to send the email message, in order to work you should do something like this:

<textarea name="codes" class="area"> <?php echo $product_id_array; ?></textarea><br />

but for the engravings which can be multiple if the cart handles more than one item.

I want to point you to a problem: the textarea even if hidden can be modified and used by the user to submit whatever he wants, the same applies to the total. It is extremely unsafe. You should not accept this input from this form, but calculate it on server side basing on what you have saved in the session. It's correct to display this information to the user, but never retrieve it, as you already have what you need to define totals and item list.

So best solution is to elaborate all this information on server side, create and a table that will be included in your email message, so instead of $codes_field = $_POST['codes']; do:

$rows = [];

foreach($_SESSION["cart_array"] as $each_item)
{
    $rows[] = "
        <tr>
            <td>{$each_item['item_id']}</td>
            <td>{$each_item['engraving']}</td>
            <td>{$each_item['quantity']}</td>
        </tr>
    ";
}

$codes_field = "
<table>
    <thead>
        <tr>
            <th>Item ID</th>
            <th>Engraving</th>
            <th>Quantity</th>
        </tr>
    </thead>
    <tbody>
        ". implode(PHP_EOL, $rows) ."
    </tbody>
</table>
";

Instead of $total_field = $_POST['total']; generate the cart total as in section 5, do not trust the form. To avoid repetition of tasks you could update a session variable each time the cart is updated, so on section 5, after line …

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, at line 146 you set:

$cartOutput .= '<td><form action="cart.php" method="post"><input name="text' . $item_id . '" type="text" class="submit" value="" /><input name="engraving" type="hidden" value="' . $i . '" /></form></td>';

It means that $_POST['engraving'] will assume the value of $i which is starting from 0 because the $i++ is placed at the bottom of the loop. Also $_POST['text123'] is defined by the item_id, so you must read this index to access the engraving message, not $_POST['engraving'].

At line 58 we have:

if (isset($_POST['engraving']) && $_POST['engraving'] != "") {

    $engraving = $_POST['engraving'];
    $i = 0;

    foreach ($_SESSION["cart_array"] as $each_item) {

        $i++;
        while (list($key, $value) = each($each_item)) {

            if ($key == "item_id" && $value == $engraving) {

              array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $engraving)));

            }
        }
    }
}

Here $i++ starts from 1 because is not at the end of the foreach loop, then the IF statement that should match the item_id:

if ($key == "item_id" && $value == $engraving) {

is trying to match the value of $engraving which is the value assigned by the $i in the table block code: this can match only by accident, in most cases it will correctly fail. Also the array_splice is going to rewrite only the item_id by the $i value, not including the engraving nor the quantity.

Here you must decide if you want to update the cart_array by index key or by item_id and then move all the forms in this direction.

At the moment, to just patch the above code you …

cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome! If the above is full code I can try few tests, otherwise I can only suggest you to break each step to see where it fails, you can do this by:

  1. rewriting each part and feeding some example arrays;
  2. or by using die(print_r($var)) statements in the original code, where $var is the variable you want to check.
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, you can create a method in your controller, search the database table and use the Download helper, for example:

public function download($id)
{
    # load download helper
    $this->load->helper('download');

    # search for filename by id
    $this->db->select('filename');
    $this->db->where('id', $id);
    $q = $this->db->get('tablename');

    # if exists continue
    if($q->num_rows() > 0)
    {
        $row  = $q->row();
        $file = FCPATH . 'files/'. $row->filename;
        if(file_exists($file))
            force_download($file, NULL);
    }

    else
        show_404();
}

Then simply create a link that points to the above method, for example:

http://site.tld/controller/download/123

Docs: http://www.codeigniter.com/user_guide/helpers/download_helper.html

cereal 1,524 Nearly a Senior Poster Featured Poster

Have you tried by moving the condition to the WHERE statement? For example:

SELECT * FROM MY_TABLE WHERE BIT_COUNT(CAST(CONV(value,16,10) as unsigned integer) ^ CAST(CONV('$submit', 16, 10) AS UNSIGNED) ) >= 14;
cereal 1,524 Nearly a Senior Poster Featured Poster

Using $_POST['engraving'] as value of the input form assumes a previous step in which you set the value, i.e. another form, but if this form is accessed through a GET request the value will get lost.

Check how you set the values in the cart_array session, because on section 3 it seems you're setting only item_id and quantity, an example:

<?php


    $a[] = [
        'item_id'   => 123,
        'quantity'  => 21,
        'engraving' => 'hello world'
    ];

    $a[] = [
        'item_id'   => 124,
        'quantity'  => 17,
        'engraving' => 'hello to you'
    ];

    $i = 0;
    $item_to_adjust = 123;
    $quantity = 34;

    foreach($a as $each_item)
    {
        $i++;
        while (list($key, $value) = each($each_item))
            if ($key == "item_id" && $value == $item_to_adjust)
                array_splice($a, $i-1, 1, array(array("item_id" => $item_to_adjust, "quantity" => $quantity)));
    }

    print_r($a);
    print PHP_EOL;

It will return:

Array
(
    [0] => Array
        (
            [item_id] => 123
            [quantity] => 34
        )

    [1] => Array
        (
            [item_id] => 124
            [quantity] => 17
            [engraving] => hello you
        )

)

Try to simply replace the array_splace line with:

array_splice($a, $i-1, 1, array(array("item_id" => $item_to_adjust, "quantity" => $quantity, "engraving" => $each_item['engraving'])));

And it should work.

cereal 1,524 Nearly a Senior Poster Featured Poster

Sorry I meant cart_array:

<?php

    session_start();

    echo "<p>Session array:</p>";
    echo "<pre>" . print_r($_SESSION['cart_array'], true) . "</pre>";

Then point the form to a dummy cart script:

<?php

    echo "<p>Post array:</p>";
    echo "<pre>" . print_r($_POST, true) . "</pre>";

To see if all input fields are sent by the form.