Hey everyone ...
I have a button on my page: -
<input name="button" type="button" class="style3" onclick="window.print()" value="Print Coupon" />
-
that uses window.print() to print a coupon. I would like to add a function to the code that updates a field in a database that tracks how many coupons are printed. Is there a way to add this function: -
$CouponNo = $CouponNo + 1;
-
mysql_query("UPDATE tbl_depts SET CouponNo = $CouponNo WHERE `key` = $spec");
-
to that button?
Thanks for any help
Robert
2 1225 Atli 5,058
Recognized Expert Expert
Hi Robert.
HTML and JavaScript, being server-side monstrosities, can not directly interact with PHP, as that is a server-side language.
You can, however, use tools such as Ajax to make HTTP requests on your server to execute PHP scripts.
For example, if you were to put your PHP code, the one you posted above, in a PHP file, you could use Ajax to request that file from your server, which would effectively increment you coupon count.
Thanks for your reply. I actually figured it out over the weekend.
In Dreamweaver, you can tag more than one behavior to the "onclick" so I ended up using this code: -
<input name="button" type="button" class="style3" onclick="window.print() ;MM_goToURL('parent','../DeptSpecials.php');<?PHP $CouponNo = $CouponNo + 1 ?>;return document.MM_returnValue" value="Print Coupon" />
-
Works great ...
Again, thanks for your help.
Hope everyone has a great holiday season.
Robert
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: @sh |
last post by:
Can anyone help out here please, we have a button that when pressed will
alert the user, should they cancel no action is taken, however should they
confirm, the script will disable the button and then submit the form...
Could someone correct this lump of code for us pleaseeeeeeee ;o)
<input name="Submit" type="button" class="EmployerPostJobForm" value="
Verify Job " id="mFormSubmit" onClick="if(confirm('You are about to verify
this...
|
by: Hartmut Schroth |
last post by:
Hi,
I need a solution for the following problem:
In the item template of a datalist control I have already
a button control with the commandname set to "select" to
perform some specific database action. I additionally want
to update an integer value in the underlying data source
by simply clicking an a check box or an imagebutton
WITHOUT USING THE EDIT/UPDATE COMMANDNAME property of the
|
by: SAL |
last post by:
Hello,
I created a WebPage.aspx that has some functions in it, and I created a User
Control that has a File Field Control and a Botton control on the .ascx. I
added myUserControl.ascx to the WebPage.aspx, but it can not access the
WebPage.aspx functions.
If I add a button to the WebPage.aspx, I can access those functions no
problem. Is not adding a User Control the samething? If not, what must I do
in myUserControl.ascx file so I...
|
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= |
last post by:
I'm building a test web application that, when run, will launch calc.exe on
my computer. It seems to work as it appears in Windows Task Manager;
however, the process doesn't actually pop up because it runs as ASPNET rather
than the user I want. When having to run ASP.NET as another user (e.g. when
doing AD queries), I was able to use IIS Windows Authentication and
impersonation. These are still enabled, but they don't seem to be helping....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |