Create a php page that will process the order using an array and display the results on another page.

your html form must look like blown:

<form action=”hardware_order.php” method=”post”>
<legend>Order Form</legend>
<p><label for=”user”> Name</label> <input type=”text” name=”name” id=”user” /></p>
<p><strong>Select Some Products:</strong> <br>
<select name=”products[]” multiple>
<option value=”Sonic Screwdriver”>Sonic Screwdriver</option>
<option value=”Hammer”>Hammer</option>
<option value=”Drill”>Drill</option>
<option value=”Spanner”>Spanner</option>
<p><input type=”submit” name=”submit” value=”send”></p>

there are two ways can proceed this: one is :
$name =trim($_POST[‘name’]);
echo “nothing has been selected”;
echo “Thanks “.$name.” your select products is “;

foreach($_POST[‘products’] as $o)
echo $o.”<br/>”;
another ways is teacher’s answers:
$name =trim($_POST[‘name’]);
if (!empty($name))
{     echo “<p>Welcome <b>$name</b>!</p>”;
echo “<p>Enter a name</p>”;

echo “<ul>”;
echo “<p>Your product choices are:<br/>”;
foreach ($_POST[‘products’] as $value)
echo “<li>$value</li>”;
echo “</ul>”;
echo “<p> Nothing selected</p>”;


The Chinese Zodiac | a code demonstration for PHP

The Chinese Zodiac | a code demonstration for PHP

Chinese zodiac signs represent twelve different types of personalities. Traditionally beginning with the sign of the rat. Though the animal assigned for the birth year is not wholly who a person is, as there is also an animal assigned by the birth month called inner animals and by the birth hour called secret animals. These with a combination of five elements, make up 8,640 possible combinations for a persons personality trait, and all are considered important for the proper use of chinese astrology.

There are many versions of the story about the beginning of the zodiac, one such story begins with the rat being given the task on inciting the animals to report to the Jade Emperor to be selected for the zodiac. The cat being one of the animals selected was a good friend of the rat who tricked him into believing the banquet was a day later and the cat slept through it thinking it was not till the next day. When the cat found out he vowed to be the rats’ swore enemy for the ages.

use file store infomation to string

$outputstring = $date.”\t”.$tireqty.”\t”.$oilqty.” oil\t”.$sparkty.” spark plugs\t\$”.$totalamount.”\t”.$address.”\n”;

@$fp = fopen(“DOCUMENT_ROOT/../orders/orders.txt”,’ab’);

echo “<p><strong>Your order could not be process at this time. Please try again later.</strong></p></body></html>”;
fwrite($fp, $outputstring,strlen($outputstring));
flock($fp, LOCK_UN);

echo “<p>Order written.</p>”;

Loading Arrays from Files (use for loop)

$number_of_orders = count($orders);
if ($number_of_orders == 0){
echo ”

No orders pending.Please try again later.



for ($i=0;$i<$number_of_orders;$i++){

echo $orders[$i].”


3 dimensional arrays with for loop

    $categories = array(array( array( ‘CAR_TIR’, ‘Tires’, 100 ),
                        array( ‘CAR_OIL’, ‘Oil’, 10 ),
                        array( ‘CAR_SPK’, ‘Spark Plugs’, 4 ) ),
                 array( array( ‘VAN_TIR’, ‘Tires’, 120 ),
                        array( ‘VAN_OIL’, ‘Oil’, 12 ),
                        array( ‘VAN_SPK’, ‘Spark Plugs’, 5 ) ),
                array( array( ‘TRK_TIR’, ‘Tires’, 150 ),
                        array( ‘TRK_OIL’, ‘Oil’, 15 ),
                        array( ‘TRK_SPK’, ‘Spark Plugs’, 6 ) )
    for ($layer =0;$layer <3; $layer++){
        echo “layer $layer<br/>”;
        for ($row =0; $row<3; $row++){
            for ($column =0; $column<3; $column++){
            echo ‘|’.$categories[$layer][$row][$column];
            echo ‘|<br/>’;

a simple sample for loop and while loop in php

$prices = array(‘Tires’=>100, ‘Oil’=>10, ‘Spark Plugs’=>4);

The foreach loop has a slightly different structure when using associative arrays.You
can use it exactly as you did in the previous example, or you can incorporate the keys as
foreach ($prices as $key => $value) {
echo $key.” – “.$value.”<br />”;

The following code lists the contents of the $prices array using the each() construct:
while ($element = each($prices)) {
echo $element[‘key’];
echo ” – “;
echo $element[‘value’];
echo “<br />”;

There is a more elegant and more common way of doing the same thing.The construct
list() can be used to split an array into a number of values.You can separate two
of the values that the each() function gives you like this:
while (list($product, $price) = each($prices)) {
echo “$product – $price<br />”;

The output of this script fragment is shown in Figure 3.2.

Tires – 100
Oil – 10
Spark Plugs – 4

Visual Studio 2010 freedown + Crack

first:Microsoft Visual Studio 2010 down(come from

      (Premium) 【link】



then,Help->Register Product->:YCFHQ-9DWCY-DKV88-T2TMH-G7BHP then enter



or you can

       use thisProduct Key:YCFHQ9DWCYDKV88T2TMHG7BHP,to cover setup.sdb [Product Key]

if you already install fee trial, just change Product Key:YCFHQ9DWCYDKV88T2TMHG7BHP,then fine.

xml and xsl and css connected example

first, you need have a wine.xml,this is for store your wines database: see below:

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/css” href=”wine.css”?>
<!DOCTYPE wines [
<!ELEMENT wines (wine+)>
<!ELEMENT wine (name,country,location,history,color,year,served)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT history (#PCDATA)>
<!ELEMENT color (#PCDATA|span)*>
<!ELEMENT served (#PCDATA)>
<?xml-stylesheet type=”text/xsl” href=”wine.xsl”?>
<name>Rough Red</name>
<history>Some oenologists believe that Rough Red goes back to Roman times.</history>
<color>dark ruby-red wine – traditionally, it is called,<span>”black as rabbit’s blood”</span></color>
<served>Rough Red should be served at 15 – 16 _C(59 – 60.8_F)

<name>Cabernet Merlot</name>
<country>South Australia</country>
<history>A soft, round and gloriously fleshy palate delivers flavours of ripe plum, red berries along with subtle liquorice and chocolate, finishing in a smooth and elegant fashion.
This is such an easy-drinking, soft and approachable wine. There is wonderful flavour and richness but it’s not at all confronting…a bit like a red wine with training wheels…and a true little treasure!</history>
<color>dark ruby-red wine – traditionally, it is called,<span>”black as rabbit’s blood”</span></color>
<served>Rough Red should be served at 15 – 16 _C(59 – 60.8_F)


Then,save as win.xml you use xsl to style your wines’ data, see below(xml can let your xml data display in html ) Continue reading xml and xsl and css connected example

What is XML? What is XSL? What is the relationship between XML AND XSL?

What is XML?

  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to carry data, not to display data
  • XML tags are not predefined. You must define your own tags
  • XML is designed to be self-descriptive
  • XML is a W3C Recommendation

What is XSL?

XSLT is the recommended style sheet language of XML.

XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.

XSLT can be used to transform XML into HTML, before it is displayed by a browser.

What is the relationship between XML AND XSL?

XSL gives your XML some style