Free Android CakePHP GMaps Articles by Bali Web Design

July 29, 2008

How to post form into a popup window

Filed under: html,javascript — Tags: , — admin @ 10:04 am

When you need to send a variable to a popup window from mainpage, ussually we will put it in url as GET method. But using this problem we will get problem when the variable has long character. We know that GET has limited long.

So we need to use POST method to submit a form. But how we can do it? I have a trick how to do it.

First we create a javascript for handling onsubmit event on html form.

function thePopupWindows(windowsname){
var win ='', windowsname, ''width=580,height=450');
return true;

and then set this function on HTML Form :

<form action="popupwin.php" method="post" target="thepopup" onsubmit="return thePopupWindows(;">
<input id="name" name="name" type="text" />
<input type="submit" value="Submit">

July 10, 2008

Add page break on HTML page

Filed under: html — Tags: — admin @ 10:03 am

Sometimes we want to add a page break on specific part on the page for printing. We can do it with simple css method for adding page break on specific part that you want a page break is occur.

So when you need to add page break on specific place, you just need to add this html code :

<p style="page-break-before: always">

on part that you want a page break occur.

for example :

<p>This is page 1</p>
<p style="page-break-before: always">
<p>This is page 2</p>

If we print this html, we will have two pages printed.

July 9, 2008

how to search value inside a set or array in mysql

Filed under: mysql,query tips — Tags: , — admin @ 10:01 am

Sometimes we have data in a field on our table like this “1,2,3,4,5,6,7”, and we want to search for example number 2. Beside doing searching inside php, we can do it in sql query. I found one function for retrieving position of a value inside a set : FIND_IN_SET(str,strlist).

So the query will look like this :

SELECT * FROM table_name WHERE FIND_IN_SET(2, field_name) > 2;

This query will return all recordset that have number 2 in field_name set.

Another way to searching a value inside a set, is by manipulating on how we save the set in field. So if we want to save a set of “1, 2, 3, 4, 5, 6, 7”, we will save it as “<1>,<2>,<3>,<4>,<5>,<6>,<7>” in database. And doing query using this method :

SELECT * FROM table_name WHERE field_name LIKE ‘%<2>%’;

but of course the first way is more faster. because first way we search value in array / set, but second way search value in string.