PHP form with two submit buttons for each “target” attribute

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mi1400
Forum Newbie
Posts: 3
Joined: Sat Dec 26, 2009 1:17 pm

PHP form with two submit buttons for each “target” attribute

Post by mi1400 »

Dear experts i am using code from http://stackoverflow.com/questions/9427 ... attributes
------------------------------------------
function subm(f,newtarget)
{
document.myform.target = newtarget ;
f.submit();
}
<FORM name="myform" method="post" action="" target="" >
<INPUT type="button" name="Submit" value="Submit" onclick="subm(this.form,"_self");">
<INPUT type="button" name="Submit" value="Submit" onclick="subm(this.form,"_blank");">
------------------------------------------
but it is causing two IE windows to pop. Firefox behaves fine. I am on WinXP SP2 IE6.
One of my two buttons are to populate db-resultset on bottom of same page in grid and after the grid a second post button PRINT submitting same page to launch report with same data as in grid. i have put the whole php page in IF ELSE. IF part checks if populate grid button is cliked then the default page is generated and in ELSE i check whther PRINT REPORT button is clicked i have made a non formatting page between <Table> --->RPEORT DATA<--- </Table>. hence none of the top left right bottom menus appear and just flat/simple report layout.

I m seeking solution for why IE is nehaving like this. none of the windows comes blank. one is the nomral replica of what is like before pressing any button (plus result grid) and second poped window shows my report. Firefox works perfectly showing the report layout/data in poped tab.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP form with two submit buttons for each “target” attribute

Post by requinix »

I would bet that

Code: Select all

function subm(f,newtarget)
{
document.myform.target = newtarget ;
f.submit();
return false;
}
<FORM name="myform" method="post" action="" target="" >
<INPUT type="button" name="Submit" value="Submit" onclick="return subm(this.form,"_self");">
<INPUT type="button" name="Submit" value="Submit" onclick="return subm(this.form,"_blank");">
would fix it.
mi1400
Forum Newbie
Posts: 3
Joined: Sat Dec 26, 2009 1:17 pm

Re: PHP form with two submit buttons for each “target” attribute

Post by mi1400 »

Dear tasairis, it didnt work. could u further see what could be the problem. Thank you.
mi1400
Forum Newbie
Posts: 3
Joined: Sat Dec 26, 2009 1:17 pm

Re: PHP form with two submit buttons for each “target” attribute

Post by mi1400 »

Please assist...
Post Reply