This topic is locked

postcode and number

10/24/2014 11:31:19 AM
PHPRunner General questions
D
droogers author

Hello,
in my edit page I use the following custom record update event:

global $conn;

$postcode=$values['postcode'];

$number=$values['nr'];

$postcode_id=substr($postcode, 0, 4);

$postcode_id.=ord(substr($postcode, 4, 1));

$postcode_id.=ord(substr($postcode, 5, 1));

$str = "SELECT * FROM postcode WHERE postcode_id=$postcode_id AND (minnumber <= $number AND maxnumber >= $number)";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

$values['straat'] = $data["street"];

$values['woonplaats']=$data["city"];
// Place event code here.

// Use "Add Action" button to add code snippets.
return true;



This code works good. When I fill in the fields postcode and nr and I safe the record, the fields straat and woonplaats are filled in automatically.

My question now is of there is possiblity that the straat and woonplaats are filled on automatically after I filled in the postcode and nr. Another possibiltiy is to make a button on the edit page to do this. For both possibilties I don't now what the code is.