Jump to content

Gathering info from Shipping Tracker


lilith2014

Recommended Posts

Hello ppl! new in here and in php.

 

I need to create a php file where a customer can track 4 shipments instead of one. I meant "instead of one" because right now the site has capability for only one tracker.

The thing I need to know is how to pull out the information from the tracker and how can I make 4 trackers instead of one. I dont know where to start.

the website is www.cglship.com and you will see the tracker at the right bottom corner. Basically my job is to re skin the website using Joomla! as a CMS, so In a module I will include this 4 trackers.I thought was only creating 4 input box calling the tracking.php file but Im not sure whatsoever.

 

Thank you all

Link to comment
https://forums.phpfreaks.com/topic/104439-gathering-info-from-shipping-tracker/
Share on other sites

Make four different input boxes and call post data for each. Assign each input a different name, like "track1", "track2" and so on. In the dhl or fedex sites ive seen the option to enter several track ids seperated by comma. So a simple script should be:

 

<?php
$track = $_POST['track']; //a dump value like: "123,133,444, 576"
$track = explode(',', $track);
foreach($track as $val){
    $val = intval(trim($val));
    $results = mysql_query("SELECT place FROM tracking WHERE trackid=$track");
    if(mysql_num_rows($results) == 0){
         echo 'We dont have a shipment with the track number: ' . $val;
    } else{
         $values = mysql_fetch_array($results);
         echo 'The package is in: ' . $values['place'];
    }
}
?>

 

Hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.