DanielHardy Posted March 25, 2010 Share Posted March 25, 2010 Hi All, My first post here for a while. I have created a cms so to speak. It uses a simple login system and ajax so that an admin can edit the text on the page, this then updates a html file that stores the text, and the actual page simply echos the html text. If you navigate to: http://moroccannatural.com/rhassoul.php You will see that the £7.50 price at the bottom is editable. When this is edited, I of course need it to update the amount value in the paypal form. The form is here: <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="float:left;padding-left:15px;"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="[email protected]"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="item_name" value="Rhassoul Clay 200g"> <input type="hidden" name="amount" value="7.50"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="button_subtype" value="products"> <input type="hidden" name="shipping" value=""> <input type="hidden" name="add" value="1"> <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest"> <input type="image" style="outline:none;" src="cart.jpg" name="submit2" onmouseover="javascript:this.src='cart2.jpg';" onmouseout="javascript:this.src='cart.jpg';"> </form> Here is the php that I think you will need to help : <?php $codeToBeEdited5 = file_get_contents('text5.html'); $idName5 = 'desc5'; require_once('AjaxEditInPlace.inc.php'); $ajaxEditInPlace = new AjaxEditInPlace($codeToBeEdited5, 'showText'); echo $ajaxEditInPlace->getEditInPlaceCode($idName5); ?> I have tried lots of things such as <input type="hidden" name="amount" value="<?php echo $idName5 ?> "> Please help me! Thanks Dan Quote Link to comment https://forums.phpfreaks.com/topic/196487-editing-paypal-value-using-php/ Share on other sites More sharing options...
JAY6390 Posted March 25, 2010 Share Posted March 25, 2010 This is a javascript problem not a php problem if you are achieving this without a page refresh You will need to use the getElementByName('amount').value and set the value accordingly with javascript when your ajax completes the change Quote Link to comment https://forums.phpfreaks.com/topic/196487-editing-paypal-value-using-php/#findComment-1031637 Share on other sites More sharing options...
DanielHardy Posted March 25, 2010 Author Share Posted March 25, 2010 Could you possibly expand your reply a little for me? I am struggling to follow it being a relative javascript novice Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/196487-editing-paypal-value-using-php/#findComment-1031652 Share on other sites More sharing options...
JAY6390 Posted March 25, 2010 Share Posted March 25, 2010 I'm not really sure I can. You just need to use javascript to change the value when the ajax request completes successfully to the value in that field. It's basic javascript really, and if you haven't got this knowledge you shouldn't be touching ajax so soon Quote Link to comment https://forums.phpfreaks.com/topic/196487-editing-paypal-value-using-php/#findComment-1031654 Share on other sites More sharing options...
DanielHardy Posted March 25, 2010 Author Share Posted March 25, 2010 Much simpler solution was to simply use: echo $codeToBeEdited5; There is a problem in that you have to refresh the page before the changes take effect, but this isn't a problem as this is an admin section, so when you log out, the changes will have taken efect. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/196487-editing-paypal-value-using-php/#findComment-1031657 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.