Month: October 2010

Pop window in php


I have struggling for hours to find a code purely in php for a popup window. The code is quite simple but a bit tricky. it requires java script to be integrated in the php code.  Here it is

  1. value1=urlencode('some value');

  2. echo "<a href=\"javascript'page.php?param1=$value1','name1','height=320,width=240');\">pop-up</a>";

For example I need to add a code in my php script to open a pop up window, here it is;

echo "<a href=\"'editspares.php?id=$spareid&refno=$reference_id','Edit Spare Parts','height=50,width=650');\">Edit</a>";

If you want to run two instance of apache, there is a trick. I tried this for easyphp & XAMPP on windows. I was already having a working XAMPP server on my windows PC. I installed easyphp on the same PC. Now when I tried to start apache it gave that firewall has block the port and therefore cannot start apache. you just need to change the port for apache . Edit the file \apache\conf\httpd.conf and edit l following line


You can also try any other number. Also when you open the browser to run any script: Like



File info.php


How to add/allow special characters in mysql – php data interchange

To prepare data for insertion to a text field in MySQL via PHP use the
following function;

$additional_notes = mysql_escape_string($raw_additional_notes);    ///to escape the special charecters		
and to get it back to normal after reading it from the database...
$raw_additional_notes= stripslashes($additional_notes);

Basically the special characters are allowed in mysql with backslaches (“\”) therefore to add any such charectar, string needs to rewritten according to mysql. Using mysql_escape_string() function  the slashes can be added in string.

stripslashes() can revert back the same string deleting slashes.