HTML tag label is useful for Radio buttons

Radio Buttons

To click on a Radio button is very boring things to me. A radio button is maximum 15 x 15 pixels. So need extra care to click on Radio buttons.

When I work with Radio buttons in my web applications, I use HTML tag - ‘Label‘.

For example, I have a Radio button like this-

<input type=”radio” name=”test” id=”test_id” value=”something” /> Click on this Radio button

This Radio button require extra care to click. I write the above code like bellow, so that the visitors can select the Radio button clicking on the text - “Click on this Radio button“.

<input type=”radio” name=”test” id=”test_id” value=”something” /> <label for=”test_id”> Click on this Radio button</label>

Now the visitors can select the Radio button clicking on the text. Enjoy easy clicking on the Radio buttons.

Posted in HTML. Tags: . 5 Comments »

Two simple services - IP address and little url

Two simple services

I have added two simple services in this website.

One: IP address- some times we need to know what is the public IP address of my PC? Most of the ISP provide private IP address under their server. Some ISP provide DHCP enabled IP address. To know what is your current IP address click here. - http://arafatbd.net/ip/

Two: Little URL- Its very difficult to remember long URLs. Sometimes we need short URL to put some places. Sometimes we like to hide the original URL. To serve these purposes, we need little URL. Click here - http://arafatbd.net/url/

HTML form :: difference between disabled and readonly element

I was working with HTML forms. In the forms I used readonly and disabled input elements. What is the deference between these two attributes of input element?

Say for I have an input element in HTML form.

<input type="text" name="full_name" value="My Name Here" readonly="readonly" />

If we set the attribute readonly=”readonly then the input element is not editable. This attribute allows the user to highlight and copy the text inside the input field, but not change the value.

This attribute is only used if the type attribute of the input element is set to “text” or “password”.

I have another text field like bellow.

<input type="text" name="email" value="my@email.here" disabled="disabled" />

If we set the attribut disabled="disabled", the input element is disabled, un-editable and un-selectable. This attribute not allow the users to highlight and copy the text inside the input field. Another thing happen here, the data within the input element will not be submitted to the action page.

Talking with PHP

Talking with PHP

Talking with PHP

I need the current time then I call the php function - time() and get the current Unix timestamp. Then function time() returns the second measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). Say for, in my website users can register for free for one year. I need to calculate an account expiration time after one year. How can I calculate the expiration time. I need to add one year with the account creation time. We may get the the date and time of account expiration using following code.

$expiration = date( 'Y-m-d H:i:s', time() + (365 * 24 * 60 * 60) );

I have another easy solution. See bellow.

$expiration = date('Y-m-d H:i:s', strtotime( 'now + 1 year' ) );

Everyone knows PHP is a flexible language. In the second statement, it seems I am talking with php. ha ha ha

Posted in PHP. No Comments »

Submit HTML form to pop up window

Some times we may need to submit HTML form to a pop up window. Let’s take a look into the details.
Say for I have a HTML form.

<form name="contactForm"  method="post" action="thank-you.php">
Name : <input type="text" name="name" id="name" /> <br />
E-mail : <input type="text" name="email" id="email" /> <br />
<input type="submit" value="Submit" />
</form>

We may submit this form to a blank window by setting target=”_blank”, but when we need to submit the form to a pop up window then we should do some extra code. Let’s try.

Step one: Defining a JavaScript function
function openWindow(url, wname, width, height) {
window.open(url, wname, "height=" + height + ",width=" + width + "location = 0, status = 1, resizable = 0, scrollbars=1, toolbar = 0");
return true;
}

Above function opens a pop up window according to the supplied arguments. There is a tricky thing. ‘name’ is a keyword in JavaScript. We should not put the variable name as ‘name’. IE reports error if we put name as a variable name.

Step two: Setting the form attributes
Now we set the form attributes like bellow
<form name="contactForm"  method="post" action="thank-you.php" target="popupWin" onsubmit="return openWindow('thank-you.php', 'popupWin', 600, 500);">

Step three: Preparing thank you page
Now we are ready to prepare the thank-you.php page for processing the form data.

Some more things must follow for security and to protect spamming. We should apply both JavaScript and server side validation into the form, protect spamming and XSS.

Measure your internet speed

I tried several software to measure internet speed, but those software don’t provide the right measurement. Few days ago I got a link to measure internet speed. I found this working fine.

Lets take a look click here

http://www.gambitdesign.com/bandwidthmeter/initialmeter.php

What do you think? Do you have any tool to measure the internet speed?

I found another speed testing application here, but need java run time environment.

http://www.internetfrog.com/mypc/speedtest/

Internet Connection at My Home

internet-connection.gif

Last one year I used an internet connection of a local ISP at Dhanmondi. I was not happy with them. Most of the time their server got down. If I called them they told “there is a problem in a hub or switch”. I was very much angry with them. I started to keep a log file of connection status manually in excel file. I found 60% of the total time my PC was disconnected.

I left them. Now I am using GPRS connection of Teletalk using Motorola L6 mobile set.

The average download speed is 6 KB. Average uptime 95%. I am satisfied with this connection.

What is your connection? How is your feelings?

CakePHP Manual in PDF Format

“Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.”

Manual for CakePHP is available here - http://manual.cakephp.org/ in HTML format. I converted that into PDF. This will help those who likes more to read PDF than HTML.
Download CakePHP Manual in PDF Format

Cheers

Thanks Hasin Vai, I am including your links here

http://cakeforge.org/frs/download.php/281/cake-manual.chm

http://cakeforge.org/frs/download.php/280/cake-manual.pdf

http://cakeforge.org/frs/download.php/279/many-pages-html.zip

Document to PDF Conversion :: Any Idea ?

Hi All,
Now a days I am working on Document to PDF Conversion using PHP. I got a few tutorial on it, but not complete solution. Have you any idea ?
Thanks.

Another osCommerce Contribution

Hi all,

Today I fixed a simple bug of GuestBook module for osCommerce.

You can download the module from here.

http://www.oscommerce.com/community/contributions,138

Cheers