Thursday, November 20, 2014

Translating Form/Javascript Values to PHP & Back

According to Skytopia's clever 'Send, pass, get variables with PHP, Form, HTML & JavaScript code' webpage:

"Javascript variable to PHP variable: This is impossible (unless you reload the page, or call another page), since all PHP code is rendered first (on the server side), and then Javascript is dealt with afterwards (on the client side)...Form variable to PHP variable: Without refreshing, this is impossible like above for similar reasons. If you don't mind a refresh, then either a page reload or calling another web page would work if you used something like $_POST['FormVar']; in the php file". 

Skytopia does not provide any example of how the Javascript variable to PHP variable trick is accomplished by "calling another webpage".

However, on my second day of PHP programming, I was able to create a single PHP page that succeeds in: passing a Javascript variable value to a PHP variable value, without reloading, with all the action on one webpage; and also, passing a form variable to a PHP variable without refreshing.

http://phpdisplay.net84.net/phpjsreadwritejsval.php contains an i-frame. The form-action in http://phpdisplay.net84.net/phpjsreadwritejsval.php is, action="getreceiver.php" method="get" target="ifname".  The getreceiver.php page in the Iframe, takes the variable values that originated in Javascript and form input values, translates them into PHP, manipulates them, and then sends the manipulated variable back to phpjsreadwritejsval.php where it is stored in a form input accessible to Javascript:

 PHP & Javascript Reading/Writing Javascript-produced, Javascript-readable Value

Note: the page is hosted by  000webhost for free. At first it did not work. This is because at  000webhost, if the form action summonses Getreceiver.php (beginning with a capital G) and the actual 'Getreceiver.php'  URL is getreceiver.php without a capital G, the page will not work. However in the Easyphp client-side development environment (working great for me), the difference in capitalization does not matter.

Labels: , ,

Tuesday, February 16, 2010

Soccer air dribble runs returned to, link to log page

After a vacation of about a month from the practicing the soccer, I got back to the practicing soccer again on Feb 11. I've gone on to a new practice log page which links to the others which are still up. The current soccer practice log page is at:

http://coolname001.angelfire.com/soccairfifteen.htm

This page is loaded with cool original state of the art web programming from yours truly. I used tricks I learned surfing the web, then put these tricks together and applied them in an original innovative way. I did not try to hide or obfuscate the code. I don't have the time/energy right now to give lessons on the tricks in the code but perhaps you can learn from it.

The page was very hard work. Everything that could go wrong went wrong. Even the venerable javascript malfunctioned from time to time. I had to sit at the computer sometimes for 15 hours without a break working through the problems. I felt like, if I take a break and come back to it tomorrow or in a couple of hours, my understanding of the problems will be so reduced that I have to stick it out without a break until the problems are overcome.

Like the barely audible mutterer on the Martha Stewart show said, once the new innovative programming that has never been done before is finished, it looks easy; but the pioneering work that goes into it is hard.

Labels: , , , , , ,

Saturday, February 13, 2010

Named color equivalents of the 27 mathematically basic colors in CSS HTML

This is about an online program page I created at http://coolname001.angelfire.com/namedcolors.htm which allows you to see how the named color equivalents of the 27 mathematically basic colors interact with each other.

Using hexadecimal notation such as #ffd700, or rgb notation such as rgb(255,127,255), or rgb percentile notation such as rgb(25%,54%,86%), can be a drain on time and energy. Most of us are not used to typing characters such as (, ), #, comma signs, and numbers. The numerical names of colors do not in the mind identify with any particular color.

As a result we end up using colors much less than we otherwise would and less than would be warranted by given the ratio of what we accomplish compared to the effort inputted when we are using the appropriate technique. In the modern time, a quintessence of art is color in web pages yet the colors go unused. This despite the fact that this playing around with colors accords well with scriptural injunctions against making images of things found in nature.

What I call the mathematical colors are all the colors in which the red, green and blue values are either zero or zero percent, the maximum 255 or 100%, or half-way between zero and maximum at 127 or 128, 50%. There are 27 of these colors. Most of them have named color equivalents, thus a simple name such as red can be used in the CSS and Javascript, as opposed to the cumbersome, un-descriptive notational equivalents such as rgb(255,0,0), or rgb(100%,0%,0%), or #ff0000. For the colors that do not have exact named color equivalents, the named colors that are closest to the mathematically basic color is presented.

It is important to have an understanding of the mathematically basic colors; otherwise the coloring of the page can tend towards becoming unbalanced, with too much or too little attention paid to certain colors. Now that we have mathematical colors, it makes sense to take advantage of the math of the colors as a way of maintaining the artistry of the page.

At the bottom of the table in the bottom three rows, starting with 'silver', certain colors that are not mathematically basic are presented, along with their closest named color equivalents. Colors for metals are under-represented in the list of named colors so I emphasize them here, despite the difficulties involved in presenting such colors (metallic colors tend to be a mix of colors rather than just one color, use of gifs and jpegs are recommended for them).

Using this table, one can just copy and paste the color name from the input at the top, this makes coding a page easier.

The table allows one to see not just how various color texts look on various backgrounds, but also how various color borders look on various backgrounds.

Version 1 of this page presents what the 27 mathematically basic colors look like in various text and background combinations; in this version the closest named color equivalents are not presented, rather, the exact mathematically basic colors, are presented (example, for #7f00ff the exact color #7f00ff is presented, rather than the closest named equivalent which is 'darkviolet'.

What boggles my mind is, that a local bank has hired some guy with a degree from an art school to do graphic design work for them. This guy does not even know HTML. I'm sure if I had applied to the bank for graphics design work they would not have hired me (despite my skill as evinced in my creation the online app linked to here). And then we have to bail out these banks when they of course go broke.

Important Links:

Microsoft MSDN Color Table
http://coolname001.angelfire.com/namedcolors.htm

@2009 David Virgil Hobbs

Labels: , , , , , , , ,

Monday, July 06, 2009

Program that analyzes food amino acid contents to determine type of food

I built a computer program written in javascript, which I named the "Free Online Foods Amino-acids-contents-type Calculator". This calculator greatly speeds up the task of analyzing the amino acid content of a food to determine whether it is a pre-physical-activity type food, a post-physical activity type food, or in-between.

The page containing the program is loaded at:

http://users.rcn.com/vincemoon/aminocalculator.htm

http://www.davidvirgil.qsh.eu/aminocalculator.htm

Labels: , , , , , , , ,

SM
GA
SC