Sunday, December 8, 2013

DEC 2013 My HTML5 Builder Questions

Embarcadero are at YOW Brisbane.
I will corner them with a few questions.

1. Does the user interface have a zoom function.
Can I zoom in to look at some of my screen design in finer detail?

2. Demo - What file opens why
 start>Programs>HTML5 Builder>Demos>
This opens a directory
C:\Users\Public\Documents\HTML5 Builder\5.0\Demos\ComboBox
Once again I face an issue / concern.
Logically I would have thought that double clicking on the project file would open the project but all it opens is the readme file.

So I try double clicking on index.php  and that opens the project
This seems odd?

3

Tuesday, July 30, 2013

HTML Tables with a css chaser

The basic table

<style type="text/css">
/* This is a style sheet */
/* Comments */
/* the dot '.' at the start of a line declare a class name */
.class1
{
     background-color: #CCCCff;
     margin: 0px;
      padding: 0px;
}
</STYLE>
<TABLE border=0>
<TR>
<TD> Hello </TD>
<TD> This is column 2</TD>
<TD>This is column 3</TD>
</TR>
<TR BGCOLOR='BFBFFF'>

<TD> Note the </TD>
<TD>White space</TD>
<TD>between columns</TD>
</TR>
<TD class='class1' colspan='100%'>Spans the whole table</TD>
</TR>
<TR>
<TD STYLE='border-bottom: 1px solid #000000' >Hello again  </TD>
<TD STYLE='border-bottom: 1px solid #000000' >Note the white space</TD>
<TD STYLE='border-bottom: 1px solid #000000' >the line is not continuous</TD>
</TR>
</TABLE>



Hello This is column 2 This is column 3
Note the White space between columns
Spans the whole table
Hello again Note the white space the line is not continuous

To get rid of the space between the cells
<TABLE border=0 cellpadding=0 cellspacing=0>

Hello This is column 2 This is column 3
Note the White space between columns
Spans the whole table
Hello again Note the white space the line is now continuous







Monday, July 29, 2013

HTML INPUT Tag and PHP

Nothing really to do with the Embarcadero HTML5Builder but this blog is also a convenient place to put my notes.

Basic <INPUT> tags                                                                      (Note no </input> closing tag)
<INPUT type=hidden name='xyz' value='123'>
<INPUT type=text      name='xyz' value='123'>

Array Example 1
The name can look like an array and when the $_POST array is examined, all the variables that are related are grouped together.
So in this example, we have an array called 'a' and it in turn is broken into arrays called 8904 and 8905.  Incidentally 8904 and 8905 are the id field values where the data can be inserted into the destination database table.   Obviously some obfuscating can be used to make it hard to inject dodgy data.


<INPUT TYPE=CHECKBOX NAME='Check_Edit[]' Value='8904'>
<INPUT type=text size=5 name='a[8904][invoice_line]' value='1'>
<INPUT type=text size=20 name='a[8904][our_pn]' value='0147'>
<INPUT type=text size=4 name='a[8904][invoice_quantity]' value='1'>
<INPUT type=text size=4 name='a[8904][invoice_unit_price]' value='1900.00'>

<INPUT TYPE=CHECKBOX NAME='Check_Edit[]' Value='8905'>
<INPUT type=text size=5 name='a[8905][invoice_line]' value='2'>
<INPUT type=text size=20 name='a[8905][our_pn]' value='54-NBB400'>
<INPUT type=text size=4 name='a[8905][invoice_quantity]' value='2'>
<INPUT type=text size=4 name='a[8905][invoice_unit_price]' value='14.50'>


And $_POST looks like:
a Array
8904 Array
invoice_line 1
our_pn 0147
invoice_quantity 1
invoice_unit_price 1900.00
8905 Array
invoice_line 2
our_pn 54-NBB400
invoice_quantity 2
invoice_unit_price 14.50

Array Example 2
In PHP
 // print the data
 echo "\n";
 echo "\n<INPUT type=hidden name='$urn"."[quantity]'    value='$quantity'  >";
 echo "\n<INPUT type=hidden name='$urn"."[description]' value='$description' >";

 echo "\n<INPUT type=hidden name='$urn"."[sell_price]'  value='$sell_price' >";

Note in the echo statement, we have $urn then a double quote and a dot and then another double quote "."    - This is to separate the open quare bracket from the $urn variable otherwise PHP interprets $urn as an array which of course it isn't.

The HTML looks like:


<INPUT TYPE=CHECKBOX NAME='UnplannedCheckBox[]' Value='137138'>

<INPUT type=hidden name='137138[quantity]'    value='-2'  >
<INPUT type=hidden name='137138[description]' value='Connector' >
<INPUT type=hidden name='137138[sell_price]'  value='0' >

 <INPUT TYPE=CHECKBOX NAME='UnplannedCheckBox[]' Value='137307'></TD>

<INPUT type=hidden name='137307[quantity]'    value='-3'  >
<INPUT type=hidden name='137307[description]' value='Banana Plug' >
<INPUT type=hidden name='137307[sell_price]'  value='0' >


And $_POST looks like:
137138 Array
quantity -2
description Connector
sell_price 0
137307 Array
quantity -3
description Banana Plug
sell_price 0


PHP to injest the data
// Obviously some filtering for security has to occur ....elsewhere.
$table_name = "invoice_lines";

if (isset($req_data['UnplannedCheckBox']))
    {
    foreach($req_data['UnplannedCheckBox'] as $value)
        {
        echo "\n<BR> Unplanned Issue = $value";
        $temp = $req_data[$value];
        echo "\n  temp $temp";
        print_array_recursive($req_data[$value]);
      
        $vars['invoice_number'] = $invoice_number;
        $vars['invoice_quantity'] = $req_data[$value]['quantity'];
        $vars['invoice_line_text'] = $req_data[$value]['description'];

        print_array_recursive($vars);
        add_record_to_table($table_name,$vars);  
        };
          
    };