zang8027 Posted May 13, 2009 Share Posted May 13, 2009 i got this working. When the user types in the box and clicks out of it, the url changes to add ?quan=[whatever they entered] But when it refreshes, the input box resets to the default value. Is there a way that when it refreshes, the value will now equal whatever quan=? <script type="text/javascript"> function upperCase(x) { var y=document.getElementById(x).value; self.location='index.php?quan=' + y ; } </script> <?php include('../includes/head2.php') ?> <div id="promo"> <h1>Order in bulk, and save some cash!</h1> <p>When you order a quantity of 500 or more, we'll pay your shipping and handling for you, as a token of our appreciation!</p> </div> </div> <div id="middle"> <div id="inside"> <h2>Pricing and Order Info</h2> <div class="price1"> <img src="../images/order.gif"/><br/> <!-- Form goes here --> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type='hidden' name='cmd' value='_cart' /> <input type="hidden" name="business" value="[email protected]" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="lc" value="US" /> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name_1" value="Tender Touch Towels" /> <?php //recieve the passed amount $amount = $_REQUEST['quan']; if(isset($_REQUEST['quan'])){ if($amount > 0) { if($amount <= 1000) { echo '<input type="hidden" name="quantity_1" value="'.$amount.'" />'; echo '<input type="hidden" name="amount_1" value="0.19">'; } } if($amount >=1001) { if($amount <=5000) { //post form to paypal with $amount and 0.18 echo '<input type="hidden" name="quantity_1" value="'.$amount.'" />'; echo '<input type="hidden" name="amount_1" value="0.18">'; } } if($amount >=5001) { if($amount <=10000) { //post form to paypal with $amount and 0.17 echo '<input type="hidden" name="quantity_1" value="'.$amount.'" />'; echo '<input type="hidden" name="amount_1" value="0.17">'; } } } ?> <input id="fname" class="price_box" value="So, how many would you like?" onchange="upperCase(this.id)"> Link to comment https://forums.phpfreaks.com/topic/158019-changing-input-text-value/ Share on other sites More sharing options...
Axeia Posted May 13, 2009 Share Posted May 13, 2009 http://snipplr.com/view/799/get-url-variables/ Pretty much $_GET in javascript Link to comment https://forums.phpfreaks.com/topic/158019-changing-input-text-value/#findComment-833548 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.