[ create a new paste ] login | about

Link: http://codepad.org/j3qDOPe3    [ raw code | output | fork ]

PHP, pasted on Aug 1:
<?php
$id = 0;

if(isset($_GET['item_info']))
{
    $param = $_GET['item_info'];
    if(is_numeric($param)) {
        $id = $param;
    }
}
?>


<a name="TemplateInfo" id="TemplateInfo"></a>

<?php

function report_item_not_found()
{
    echo '<span>Item nao encontrado!</span>';
}

if($id == 0) {
    report_item_not_found();
    return;
}
else 
{
    $item = getItemInfo($id);

    if(empty($item)) {
        report_item_not_found();
        return;
    }

    $row_id = $item['id'];
    $name = $item['item_name'];
    $price = $item['item_price'];
    $count = $item['item_count'];
    $img = $item['img'];
    $description = $item['description'];

    echo '
    <table width="500px" style="background-color:#fff; padding: 20px 20px 20px 20px;" align="center">
    <tr>
        <td align="center">'.$name.'</td>
    </tr>
    <tr>
        <td align="center"><img src="itens/'.$img.'"></td>
    </tr>
    <tr>
        <td align="justify" style="background-color:#f3f3f3;"><b>Descrição</b>: <br> '.$description.' <br><br></td>
    </tr>

    <tr>
        <td align="justify">Quantidade: '.$count.'</td>
    </tr>
    <tr>
        <td align="justify">Preço: <b>'.$price.' Cash</b></td>
    </tr>

</table>


<form method="post">
    <input type="hidden" name="buy" value="'.$row_id.'">
    <center><input type="image" src="content/comprar_btn.png"></center>
</form>

';
}

?>


Output:
1
2
3
4
5


<a name="TemplateInfo" id="TemplateInfo"></a>

<span>Item nao encontrado!</span>


Create a new paste based on this one


Comments: