Tree Structure Menu with php Using Recursive


CREATE TABLE IF NOT EXISTS `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_parent` int(11) NOT NULL DEFAULT '0',
`link` varchar(255) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL DEFAULT '',
`level` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;

INSERT INTO `menu` (`id`, `id_parent`, `link`, `order`, `title`, `level`) VALUES
(12, 0, '', 0, 'Office Furniture', 0),
(13, 12, '', 0, 'Chairs', 0),
(14, 12, '', 0, 'Work Tables', 0),
(15, 12, '', 0, 'Workstations', 0),
(16, 12, '', 0, 'Storage', 0),
(17, 12, '', 0, 'Conference Tables', 0),
(18, 13, '', 0, 'with spagh', 0),
(19, 13, '', 0, 'without spagh', 0),
(20, 18, '#', 0, 'Triangle', 0),
(21, 18, '#', 0, 'Sqare', 0),
(22, 19, '#', 0, 'Simple', 0),
(23, 19, '#', 0, 'Complex', 0);

PHP Code for that example

"SET NAMES utf8"));

function createsubmenu( $item )
{
global $db;
// prepare a query to get subitems of the current $item (those with parent = $item)
$subsel = $db->prepare('SELECT id, link, title, level FROM menu WHERE id_parent = :parent ORDER BY `order`');
// run the query
$subsel->execute(array('parent' => $item));
$text = '';
// fetch one row at a time, when no more rows are available $i
// will be false and while ends
while( ($i = $subsel->fetch(PDO::FETCH_OBJ)) !== false ) {
// generate code for the current $item
// will recursively call createsubmenu to add possibly existing subitems
$text .= '

  • level - 1) . '">'
    .'link) . '">' . htmlspecialchars($i->title) . ''
    . createsubmenu($i->id) . '
  • ';
    }
    // there were no items for the current call
    if( $text == '' )
    return '';
    // items were found, wrap them in an unordered list
    return '

      ' . $text . '

    ';
    }

    echo createsubmenu(0);
    ?>

    Advertisements

    php code for fedex shipment

    <?php

    // Copyright 2009, FedEx Corporation. All rights reserved.
    // Version 12.0.0

    require_once(‘ShipWebServiceClient-fedex-common.php’);
    include ‘../../config/config.php’;

    $idorder = htmlspecialchars($_POST[“idorder”]);
    $Weight2  = htmlspecialchars($_POST[“weight”]);
    $Length1  = htmlspecialchars($_POST[“length”]);
    $Width1   = htmlspecialchars($_POST[“width”]);
    $Height1  = htmlspecialchars($_POST[“height”]);
    $ServiceType = htmlspecialchars($_POST[“ServiceType”]);
    //Shipper Information
    $pShipperName  = htmlspecialchars($_POST[“pShipperName”]);
    $pShipperCompany  = htmlspecialchars($_POST[“pShipperCompany”]);
    $pShipperPhoneNumber  = htmlspecialchars($_POST[“pShipperPhoneNumber”]);
    $pShipperAddress  = htmlspecialchars($_POST[“pShipperAddress”]);
    $pShipperZip  = htmlspecialchars($_POST[“pShipperZip”]);
    $pShipperCity  = htmlspecialchars($_POST[“pShipperCity”]);
    $pShipperState  = htmlspecialchars($_POST[“pShipperState”]);
    $pShipperCountryCode  = htmlspecialchars($_POST[“pShipperCountryCode”]);

    if($ServiceType==”FEDEX_GROUND”)
    {
    $do_simple=1;
    }
    else if($ServiceType==”INTERNATIONAL_PRIORITY”)
    {
    $do_simple=2;
    }
    else
    {
    $do_simple=0;
    }

    //The WSDL is not included with the sample code.
    //Please include and reference in $path_to_wsdl variable.
    $path_to_wsdl = “wsdl/ShipService_v12.wsdl”;

    //define(‘SHIP_LABEL’, ‘shipexpresslabel.pdf’);  // PDF label file. Change to file-extension .pdf for creating a PDF label (e.g. shiplabel.pdf)

    $sql = “usp_userdetail_G $idorder”;
    $r = sqlsrv_query(conn,$sql) or die ( ‘Query Error’ );
    //define(‘r’,$r);

    while($row = sqlsrv_fetch_array($r))
    {
    $ToName=$row[“FName”];
    $tolastname    =$row[“LName”];
    $ToCompany=$row[“customerCompany”];
    $ToAddress1=$row[“CAddress”];
    $ToCity =$row[“City”];
    $ToState =$row[“State”];
    $ToPostalCode=$row[“Zip”];
    $ToPhone = $row[“Phone”];
    }
    //Sender Information

    define(‘shipper_Name’,$pShipperName);
    define(‘shipperCompanyName’,$pShipperCompany);
    define(‘shipperPhoneNumber’,$pShipperPhoneNumber);
    define(‘shipperAddressLine1’,$pShipperAddress);
    define(‘shipperCity’,$pShipperCity);
    define(‘shipperStateOrProvinceCode’,$pShipperState);
    define(‘shipperPostalCode’,$pShipperZip);
    define(‘shipperCountryCode’,$pShipperCountryCode);

    //Receptent information
    define(‘RecipientName’,$ToName.’ ‘.$tolastname);
    define(‘RecipientCompanyName’,$ToCompany);
    define(‘RecipientPhoneNumber’,$ToPhone);
    define(‘RecipientAddressLine1’,$ToAddress1);
    define(‘RecipientCity’,$ToCity);
    define(‘RecipientStateOrProvinceCode’,$ToState);
    define(‘RecipientPostalCode’,$ToPostalCode);
    define(‘Weight2’,$Weight2);
    define(‘Length1’,$Length1);
    define(‘Width1’,$Width1);
    define(‘Height1’,$Height1);
    define(‘InvoiceNumber’,$idorder);

    ini_set(“soap.wsdl_cache_enabled”, “0”);

    $client = new SoapClient($path_to_wsdl, array(‘trace’ => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information

    $request[‘WebAuthenticationDetail’] = array(
    ‘UserCredential’ =>array(
    ‘Key’ => getProperty(‘key’),
    ‘Password’ => getProperty(‘password’)
    )
    );
    $request[‘ClientDetail’] = array(
    ‘AccountNumber’ => getProperty(‘shipaccount’),
    ‘MeterNumber’ => getProperty(‘meter’)
    );
    $request[‘TransactionDetail’] = array(‘CustomerTransactionId’ => ‘*** Ground Domestic Shipping Request v12 using PHP ***’);
    $request[‘Version’] = array(
    ‘ServiceId’ => ‘ship’,
    ‘Major’ => ’12’,
    ‘Intermediate’ => ‘1’,
    ‘Minor’ => ‘0’
    );

    $complex= array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType,//’FEDEX_GROUND’, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘LabelSpecification’ => addLabelSpecification(),
    /* Thermal Label */
    /*
    ‘LabelSpecification’ => array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘EPL2’, // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘STOCK_4X6.75_LEADING_DOC_TAB’,
    ‘LabelPrintingOrientation’ => ‘TOP_EDGE_OF_TEXT_FIRST’
    ),
    */
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘PackageDetail’ => ‘INDIVIDUAL_PACKAGES’,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem2()
    ), ‘SpecialServicesRequested’ => addSpecialServices()
    );

    $complex1= array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType,//’FEDEX_GROUND’, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘LabelSpecification’ => addLabelSpecification(),
    /* Thermal Label */
    /*
    ‘LabelSpecification’ => array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘EPL2’, // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘STOCK_4X6.75_LEADING_DOC_TAB’,
    ‘LabelPrintingOrientation’ => ‘TOP_EDGE_OF_TEXT_FIRST’
    ),
    */
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘PackageDetail’ => ‘INDIVIDUAL_PACKAGES’,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem1()
    )
    );

    $complex2 =  array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘CustomsClearanceDetail’ => addCustomClearanceDetail(),
    ‘LabelSpecification’ => addLabelSpecification(),
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem2()
    ), ‘SpecialServicesRequested’ => addSpecialServices(),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ‘TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS’
    )
    )
    );

    if($do_simple!=1)
    {
    $request[‘RequestedShipment’]=$complex;
    }
    else if($do_simple == 2)
    {
    $request[‘RequestedShipment’]=$complex2;
    }
    else
    {
    $request[‘RequestedShipment’]=$complex1;
    }

    try
    {
    if(setEndpoint(‘changeEndpoint’))
    {
    $newLocation = $client->__setLocation(setEndpoint(‘endpoint’));
    }

    $response = $client->processShipment($request); // FedEx web service invocation

    //var_dump($response);

    $tracking_number=$response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;

    //var_dump($response->CompletedShipmentDetail->CompletedPackageDetails);

    //var_dump($s->TrackingIds->TrackingNumber);

    //foreach($track as $m){$m;}
    //$tracking_number=$m;
    //var_dump($s->PackageRating);

    //var_dump($tmp);

    /*echo “———————–“;
    var_dump($tmp[0]->NetCharge->Amount);

    echo “<br>”;

    echo $tmp[0]->NetCharge->Amount;
    */

    //echo $amount=explode(‘”‘,substr(explode(‘NetCharge’,explode(‘[‘,substr($data,0,800))[1])[1],0,40))[8];

    //$mid_amount=explode(‘[‘,substr($amount,0,800));
    //$mid_amount1=;

    //$amount=explode(‘”‘,substr(explode(‘NetCharge’,explode(‘[‘,substr($data,0,800))[1])[1],0,40))[8];

    if ($response->HighestSeverity != ‘FAILURE’ && $response->HighestSeverity != ‘ERROR’)
    {
    printSuccess($client, $response);

    //$trackingnumber = $response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;//Get tracking number

    if($do_simple==0)
    {

    $trackingnumber = $tracking_number;//Get tracking number
    $netshipcharge = $net_charge=$response->CompletedShipmentDetail->CompletedPackageDetails->PackageRating->PackageRateDetails[0]->NetCharge->Amount;
    }
    else
    {
    $trackingnumber = $response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;
    $netshipcharge  =  $response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    }
    //$netshipcharge  =  $response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    //$response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    echo $trackingnumber.”<br/>”;
    //echo $netshipcharge.”<br/>”;

    define(‘SHIP_LABEL’, ‘Labels/’.$idorder.”._.”.$trackingnumber.”._.’fedexGroundshipgroundlabel.pdf’);  // PDF label file.
    define(‘SHIP_CODLABEL’, ‘Labels/’.$idorder.”._.”.$trackingnumber.”._.’fedexGroundCODgroundreturnlabel.png’);  // PDF label file.

    $sql1 = “update carthead set trackingId=” where idorder=$idorder”;

    //  echo  $sql1 = “update carthead set trackingId=’$trackingnumber’ , trackingidGenratedOn=getdate(),Weight=$Weight2,Length=$Length1,Width=$Width1,Height=$Height1,fedexShippingCharge=$netshipcharge,ServiceType=’$ServiceType’ where idorder=$idorder”;

    //$r = sqlsrv_query ( conn,$sql1 ) or die ( ‘Query Error’ );

    //echo SHIP_LABEL1;

    $fp = fopen(SHIP_CODLABEL, ‘wb’);
    fwrite($fp, $response->CompletedShipmentDetail->CompletedPackageDetails->CodReturnDetail->Label->Parts->Image); //Create COD Return PNG or PDF file
    fclose($fp);
    //echo ‘<a href=”./’.SHIP_CODLABEL.'”>’.SHIP_CODLABEL.'</a> was generated.’.Newline;

    // Create PNG or PDF label
    // Set LabelSpecification.ImageType to ‘PNG’ for generating a PNG label

    $fp = fopen(SHIP_LABEL, ‘wb’);
    fwrite($fp, ($response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
    fclose($fp);

    define(‘PICKUP_SHIP_LABEL’, ‘test/shipexpresslabel.pdf’);

    $fp = fopen(PICKUP_SHIP_LABEL, ‘wb’);
    fwrite($fp, ($response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
    fclose($fp);

    //echo ‘<a href=”./’.SHIP_LABEL.'”>’.SHIP_LABEL.'</a> was generated.’;
    //header(“Location: ../../../../../../admin/getshipboxdetail.asp?Result=shipment created&idorder=$idorder”);

    //echo “<a href=’/ship/fedex/”.SHIP_LABEL.”‘></a>”;

    }
    else
    {
    printError($client, $response);
    }

    writeToLog($client);    // Write to log file

    } catch (SoapFault $exception) {
    printFault($exception, $client);
    }

    function addShipper(){
    $shipper = array(
    ‘Contact’ => array(
    ‘PersonName’ => shipper_Name,
    ‘CompanyName’ => shipperCompanyName,
    ‘PhoneNumber’ => shipperPhoneNumber),
    ‘Address’ => array(
    ‘StreetLines’ => array(shipperAddressLine1),
    ‘City’ => shipperCity,
    ‘StateOrProvinceCode’ => shipperStateOrProvinceCode,
    ‘PostalCode’ => shipperPostalCode,
    ‘CountryCode’ => shipperCountryCode)
    );

    return $shipper;
    }
    function addRecipient(){
    $recipient = array(
    ‘Contact’ => array(
    ‘PersonName’ => RecipientName,
    ‘CompanyName’ => RecipientCompanyName,
    ‘PhoneNumber’ => RecipientPhoneNumber
    ),
    ‘Address’ => array(
    ‘StreetLines’ => array(RecipientAddressLine1),
    ‘City’ => RecipientCity,
    ‘StateOrProvinceCode’ => RecipientStateOrProvinceCode,
    ‘PostalCode’ => RecipientPostalCode,
    ‘CountryCode’ => ‘US’,
    ‘Residential’ => true
    )
    );
    return $recipient;
    }
    function addShippingChargesPayment(){
    $shippingChargesPayment = array(‘PaymentType’ => ‘SENDER’,
    ‘Payor’ => array(
    ‘ResponsibleParty’ => array(
    ‘AccountNumber’ => getProperty(‘billaccount’),
    ‘Contact’ => null,
    ‘Address’ => array(‘CountryCode’ => ‘US’))));
    return $shippingChargesPayment;
    }
    function addLabelSpecification(){
    $labelSpecification = array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘PNG’,  // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘PAPER_4X9’);
    return $labelSpecification;
    }
    function addSpecialServices(){
    $specialServices = array(
    ‘SpecialServiceTypes’ => array(‘COD’),
    ‘CodDetail’ => array(
    ‘CodCollectionAmount’ => array(‘Currency’ => ‘USD’, ‘Amount’ => 1),
    ‘CollectionType’ => ‘ANY’)// ANY, GUARANTEED_FUNDS
    );
    return $specialServices;
    }
    function addSpecialServices_ORIGINAL(){
    $specialServices = array(
    ‘SpecialServiceTypes’ => array(‘COD’),
    ‘CodDetail’ => array(
    ‘CodCollectionAmount’ => array(‘Currency’ => ‘USD’, ‘Amount’ => 150),
    ‘CollectionType’ => ‘ANY’)// ANY, GUARANTEED_FUNDS
    );
    return $specialServices;
    }

    function addCustomClearanceDetail(){
    $customerClearanceDetail = array(
    ‘DutiesPayment’ => array(
    ‘PaymentType’ => ‘SENDER’, // valid values RECIPIENT, SENDER and THIRD_PARTY
    ‘Payor’ => array(
    ‘ResponsibleParty’ => array(
    ‘AccountNumber’ => ‘510087828’,
    ‘Contact’ => ‘1234567890’,
    ‘Address’ => array(
    ‘CountryCode’ => ‘US’
    )
    )
    )
    ),
    ‘DocumentContent’ => ‘NON_DOCUMENTS’,
    ‘CustomsValue’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 100.0
    ),
    ‘Commodities’ => array(
    ‘0’ => array(
    ‘NumberOfPieces’ => 1,
    ‘Description’ => ‘Books’,
    ‘CountryOfManufacture’ => ‘US’,
    ‘Weight’ => array(
    ‘Units’ => ‘LB’,
    ‘Value’ => 1.0
    ),
    ‘Quantity’ => 4,
    ‘QuantityUnits’ => ‘EA’,
    ‘UnitPrice’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 100.000000
    ),
    ‘CustomsValue’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 400.000000
    )
    )
    ),
    ‘ExportDetail’ => array(
    ‘B13AFilingOption’ => ‘NOT_REQUIRED’
    )
    );
    return $customerClearanceDetail;
    }

    function addPackageLineItem1(){
    $packageLineItem = array(
    ‘SequenceNumber’=>1,
    ‘GroupPackageCount’=>1,
    ‘Weight’ => array(
    ‘Value’ =>Weight2,
    ‘Units’ => ‘LB’
    ),
    ‘Dimensions’ => array(
    ‘Length’ => Length1,
    ‘Width’ => Width1,
    ‘Height’ => Height1,
    ‘Units’ => ‘IN’
    ),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ”
    ), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY
    ‘1’ => array(
    ‘CustomerReferenceType’ => ‘INVOICE_NUMBER’,
    ‘Value’ => InvoiceNumber
    ),
    ‘2’ => array(
    ‘CustomerReferenceType’ => ‘P_O_NUMBER’,
    ‘Value’ => RecipientPostalCode
    )
    ),
    ‘SpecialServicesRequested’ => addSpecialServices()
    );
    return $packageLineItem;
    }
    function addPackageLineItem2(){
    $packageLineItem = array(
    ‘SequenceNumber’=>1,
    ‘GroupPackageCount’=>1,
    ‘Weight’ => array(
    ‘Value’ =>Weight2,
    ‘Units’ => ‘LB’
    ),
    ‘Dimensions’ => array(
    ‘Length’ => Length1,
    ‘Width’ => Width1,
    ‘Height’ => Height1,
    ‘Units’ => ‘IN’
    ),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ”
    ), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY
    ‘1’ => array(
    ‘CustomerReferenceType’ => ‘INVOICE_NUMBER’,
    ‘Value’ => InvoiceNumber
    ),
    ‘2’ => array(
    ‘CustomerReferenceType’ => ‘P_O_NUMBER’,
    ‘Value’ => RecipientPostalCode
    )
    )//,
    //’SpecialServicesRequested’ => addSpecialServices()
    );
    return $packageLineItem;
    }
    ?>

    Paypal processing

    <div align=”center”><BR><BR><BR>
    <img src=”../image/progress.gif”><BR>
    <h3>Please wait while you are being transferred to Paypal for Payments. !</h3><BR>
    <h2>Please do not close or refresh the page</h2>
    </div>
    <form action=”https://www.paypal.com/cgi-bin/webscr&#8221; method=”post”>
    <input type=”hidden” name=”cmd” value=”_xclick”>
    <input type=”hidden” name=”business” value=’txq@txq.com’>
    <input type=’hidden’ name=’item_name’ value=’THIS DATA TO BE REQUESTED’>
    <input type=’hidden’ name=’amount’ value=’THIS DATA TO BE REQUESTED’>
    <input type=”hidden” name=”no_shipping” value=”0″>
    <input type=”hidden” name=”currency_code” value=”THIS DATA TO BE REQUESTED (USD, GBP, AUD)”>
    <input type=”hidden” name=”lc” value=”0″>
    <input type=”hidden” name=”return” value=”txq.com/thanks.php?orderid=fsd&amt=fdfds”>
    <INPUT type=hidden value=”txq.com/” name=”cancel_return”>
    <!–<input type=”image” SRC=”http://images.paypal.com/images/x-click-but01.gif&#8221; border=”0″ name=”submit” alt=”Make payments with PayPal – it’s fast, free and secure!”>–>
    </form>
    <script>
    document.forms[0].submit();
    </script>

    Php code for class example

    In this small post i will describe how to class and object are working in PHP.Class is collection of function variables. So there is we define the several function. The functions are used with reference of class. Whenever we use any part of the class we need to crate the object.   Basic example of class.

    class class_name

    {

    public name;

    public function get_name()

    {

    return $this->$name;

    }

    public function set_name($new_name)

    {

    $this->name=$new_name;

    }

    }

    Explanation:

    class_name is name of the class that you want and name is variable it store the data;  There is get_name() and set_name() is the function that can perform the work.

    Uses

    Now use of that class

    <?php

    $myobject= new class_name();

    $myobject->set_name(‘Rakesh’);

    echo  $myobject->get_name();

    ?>

    Output :

    Rakesh

     

    Note : $myobject= new class_name(); or $myobject= new class_name;

    both are same.

     

    Just Paste the code and execute it.