Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:13:31+00:00 2026-06-13T07:13:31+00:00

I have a php file which has one form and 2 submit buttons, onclick

  • 0

I have a php file which has one form and 2 submit buttons, onclick of 1 button it has to pass the value selected from a dropdown list. It is not passing the value to the php file which accepts POST data. But if I have only 1 button and the same form, this works fine.
Pl find my code below.

<html>
<head>
<title>Invoice Printing</title>

<script type="text/javascript">
function showlink() 
{
window.open('invoiceprint2.php');
} 

function showlink3() 
{
window.open('invoiceprint3.php');
}   

</script>

</head>
<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#026465">
  <tr>
    <td><div align="center"><span class="style1"> Amogh Gases Private Ltd <br></span>
<center class="style5">INVOICE PRINTING</center>
<br><br>
<br>

</td>
  </tr>
</table>

<!--------------VALIDATIONS ------------------->

<br>
<br>

<form name="form1" method="post" action="" target="_blank">
<table width='40%' height='39'  border='0' cellpadding='2' cellspacing='0'     align='center'>
<tr>
<td class='sty1'><div align='left'>Please select Invoice No. to PRINT: <br>
<br>
You can choose more than one invoice number from the options, by holding CTRL key on     your keyboard and select the numbers.</div></td>
<td>
<?php
    $con = mysql_connect("localhost","tech1","te!@#");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tech1", $con);

$result = mysql_query("SELECT Invno FROM INVHDR", $con);
echo "<select multiple='multiple' size='20' name='invnos[]'>";
while($nt=mysql_fetch_assoc($result))
{//Array or records stored in $nt
echo "<option value=$nt[Invno]>$nt[Invno]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box

mysql_close($con);
?>

</td>
</tr>
</table><br>


<center><input name="PRINT" type="button" value="PRINT Invoice to Laser Printer!"     onClick='showlink();' /> &nbsp;&nbsp;&nbsp;  <input name="PRINT2" type="button" value="PRINT Invoice to Dotmatrix Printer !" onClick='showlink3();'/>

</form>

<br><br><br><br>
<a href='frameinvoice.php' target='_parent'><input name='Add' type='button'     value='Add'></a>  &nbsp;&nbsp;  &nbsp;&nbsp; <a href='invoice-edit.php' target='_parent'>  <input name='Edit' type='button' value='Edit !'></a> &nbsp;&nbsp; <a href='invoice-cancel.php' target='_parent'><input name='Edit' type='button' value='Cancel !'></a> &nbsp;&nbsp; <a href='index.htm' target='_parent'><input name='Close' type='button' value='CLOSE !'></a><br></center>
</center>

</body>
</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:13:32+00:00Added an answer on June 13, 2026 at 7:13 am
            <html>
                <head>
                    <title>Invoice Printing</title>
    
                    <script type="text/javascript">
    
                        function postData(someValueToEvalute)
                        {
    
    
    
                            switch(someValueToEvalute){
    
                                case "1":{
                                        document.forms[0].action = 'invoiceprint2.php'
                                        break;
                                    }
                                case "2":{
                                        document.forms[0].action = 'invoiceprint3.php'
                                        break;
                                    }
                                default: { alert('fail');}
    
                            }
                            document.forms[0].submit();
                        }
    
    
    
                    </script>
    
                </head>
                <body>
                    <table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#026465">
                        <tr>
                            <td><div align="center"><span class="style1"> Amogh Gases Private Ltd <br></span>
                                    <center class="style5">INVOICE PRINTING</center>
                                    <br><br>
                                    <br>
    
                                    </td>
                                    </tr>
                                    </table>
    
                                    <!--------------VALIDATIONS ------------------->
    
                                    <br>
                                    <br>
    
                                    <form name="form1" method="post" action="" target="_blank">
    
                                    <!-- PHP CODE REMOVED!!!!! --> 
                                        <center>
                                            <input name="PRINT" type="button" value="PRINT Invoice to Laser Printer!"     onClick='postData("1");' /> &nbsp;&nbsp;&nbsp;  
                                            <input name="PRINT2" type="button" value="PRINT Invoice to Dotmatrix Printer !" onClick='postData("2");'/>
    
                                    </form>
    
                                    <br><br><br><br>
                                    <a href='frameinvoice.php' target='_parent'><input name='Add' type='button'     value='Add'></a>  &nbsp;&nbsp;  &nbsp;&nbsp; <a href='invoice-edit.php' target='_parent'>  <input name='Edit' type='button' value='Edit !'></a> &nbsp;&nbsp; <a href='invoice-cancel.php' target='_parent'><input name='Edit' type='button' value='Cancel !'></a> &nbsp;&nbsp; <a href='index.htm' target='_parent'><input name='Close' type='button' value='CLOSE !'></a><br></center>
                                    </center>
    
                                    </body>
                                    </html> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam making an app which has one index.php file. I also have these other
I have written a form which has 3 text inputs and one file input.
I have a php file which has some variables like $name1, $name2... How can
I have a php file which has a require_once Statement (?) this file is
I have an index.php file which has 2 included files require(stats.php); require(stats_encry.php); stats.php which
I'm having trouble with PHP text parsing I have a txt file which has
I have 2 files namely: uploading.php emaillinks.php both include a file inc.php which has
I have a php file which checks for login and password from users database,
I have a config.php file which has some constants and methods. I have a
I have a PHP file which has the following text: <div class=small_italic>This is what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.