Function statring function : IS there a quicker way?
Posted: Tue May 17, 2005 8:25 am
Hi All,
As the subject suggests, I'm trying to popup a window from a submit button (there are many of them on the same page).
The following code is working fine, but seems over complicated.
Any ideas on how I could 'Take a shortcut' to do the same thing?
As the subject suggests, I'm trying to popup a window from a submit button (there are many of them on the same page).
The following code is working fine, but seems over complicated.
Any ideas on how I could 'Take a shortcut' to do the same thing?
Code: Select all
// Action variable for switch
$action = ($_POST['action']);
//Click submit button
<input type="submit" name="viewFaceStock" class="btn" value="View Face Stock Specs">
//Recieve input and trigger popup passing stockId
if ($_POST['viewFaceStock']) {
view($_POST['stockId']);
}
function view($stockId) {
echo "<script language=\"javascript\">var newWindow = window.open
('".$_SERVER['PHP_SELF']."?action=viewFaceStock&stockId=".$stockId."','','scrollbars=yes,status=yes,windowX=10,windowY=10,width=440,height=550')</script>";
}
switch($action) {
case "viewFaceStock": fnViewFaceStockSpec(); break;
default: viewFaceStockSummary(); break;
}