Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , ,

Sponsored Links


Inserting PHP into button

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-01-2010
Member
 
Join Date: Dec 2009
Posts: 48
Inserting PHP into button

Sponsored Links
I am trying to make a website for my company i have a button and a PHP code. They are working smoothly if they are separate from each other but whenever i try to bind them together, They stop working so i am putting the code segments below

HTML Code:
<FORM METHOD="LINK" ACTION="../chkout/cart1/">
<INPUT TYPE="submit" class="form-button" VALUE="PHP to go here">
</FORM>
PHP Code:
<?php echo $this->__('There are <a href="%s"><strong>% items</strong></a> in your cart.'$this->getUrl('chkout/cart1'), $_cart1Quantity?>
Both these work fine if they are separated from each other but when i put them together like the one below it stops functioning.

Code:
<FORM METHOD="LINK" ACTION="../chkout/cart1/">
		<INPUT TYPE="submit" class="form-button" VALUE="<?php echo $this->__('There are <a href="%s"><strong>%s items</strong></a> in your cart.', $this->getUrl('chkout/cart1'), $_cart1Quantity) ?>">
          </FORM>
So suggest some solution so that i can insert PHP code in to an HTML Button ?


Last edited by Camdean : 06-01-2010 at 08:27 PM.
Reply With Quote
  #2  
Old 06-01-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,943
Re: Inserting PHP into button

Well according to me you cannot use the anchor tag i.e. the <a> inside the button's value attribute. Also you will have to change the text that is outputted by the PHP if you want to display it inside the button than try to remove the html from it. please specify your problem more specifically
Reply With Quote
  #3  
Old 06-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,991
Re: Inserting PHP into button

Please specify the actual output which you are getting and also specify the output which you want from the html. I think that there is something invalid in your program or function. If you specify it in more details then it will be more easier for me to implement on this problem. If possible try to post the whole program.
Reply With Quote
  #4  
Old 06-01-2010
Member
 
Join Date: Dec 2009
Posts: 48
Re: Inserting PHP into button

Well i think that i have posted enough codes so that you can easily implement any way i would like to thanks you all and hence i followed the steps suggested by praetor and posting the code below

Code:
<FORM METHOD="LINK" ACTION="../chkout/cart1/">
		<INPUT TYPE="submit" class="form-button" VALUE="<?php echo $this->__('There are <strong>%s items</strong> in your cart.', $this->getUrl('chkout/cart1'), $_cartQuantity) ?>">
          </FORM>
But i have still not got the solution.
Reply With Quote
  #5  
Old 06-01-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,371
Re: Inserting PHP into button

In the html the buttons do not work with the links. They are usually used for submitting forms that is It's the action value for the form that decides where the form will be submitted to. I would like to know what the function actually returns and the method you are calling the functions. If you show me the full source code i can help you in this case since it is difficult to implement on this problem with such small segment of code.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #6  
Old 06-01-2010
Modifier's Avatar
Member
 
Join Date: Jan 2008
Posts: 1,507
Re: Inserting PHP into button

hello friend firstly i would like to tell you that you have provided enough information so that any one can implement on a problem like this also try to replace your code with the below code:

Code:
<button class="form-button" type="button" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')">
<span><?php echo $this->__('Cart: <a href="%s"><strong>%s items</strong></a>', $this->getUrl('chkout/cart1'), $_cart1Quantity) ?></span>
</button>
I hope that your problem is fixed!!!!
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Inserting PHP into button"
Thread Thread Starter Forum Replies Last Post
How to use the G button in LG optimus black to lock screen or as camera button Zh@veri Portable Devices 7 05-12-2011 08:25 PM
Trackpad button and the left mouse button of my MacBook is not working Eun Portable Devices 12 26-09-2011 11:01 PM
Showing 16 GB when inserting new 250 GB HDD AbeAalOma Hardware Peripherals 5 25-06-2011 09:52 PM
InPrivate Browsing the go button and File button Open are not working Afiq Technology & Internet 3 06-04-2011 08:24 AM
Convert Sleep Button in Shutdown button In Vista Kraker999 Customize Desktop 3 19-03-2009 11:45 PM


All times are GMT +5.5. The time now is 06:23 PM.