change the url on the input of the searchbox - php

I have this form - How can I make the input on the text input go on the url?
<form class='divtabellinacenter' name='primo_form' action='elencoget.php".$url."' method=post>
Filtra per<br> Cognome <input class='emailtext' type=text id='filtrocognome' name=cognome value='Cogn' oninput=''>
<input type='hidden' id='savecognome' name='savecognome' value=''>
Nome <input class='emailtext' type='text' name='nome' id='filtronome' value='Nom' oninput=''>
<input type='hidden' id='savenome' name='savenome' value=''>
</form>

Related

PHP: How to use method GET, if action already contains GET value

I have a form, something like this:
<form action='index.php?page=search&filter=1'>
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>
If I submit form, it will go to page:
index.php?ID=value1&number=value2
I would like to have
index.php?page=search&filter=1&ID=value1&number=value2
How can I append extra fields to url ?
Thank you for help.
you should put these values in hidden inputs:
<form action='index.php'>
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>
You can submit additional GET value as a hidden field value in the form which will be submit along with form submission.
<form action="index.php" method="get">
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>
<input type='submit'>
</form>
Use hidden fields with your form and you will get exact url you want.
Try below code :
<form action="index.php" method="get">
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>
Try using some hidden input fields and use get method in form submitting.
Try this:
<form action="index.php" method="GET">
<input type='hidden' name='page' value='search' />
<input type='hidden' name='filter' value='1' />
<input type='text' name='ID' value='value1' />
<input type='text' name='number' value='value2' />
<input type='submit' value='Submit' />
</form>

Sagepay form submit parameters in PHP

How many parameters I need to pass the in form ULR ,It can interact with sagepay payment gateway. Following parameters are I have passed in the form url but I ma getting the following error:
Error:
Error number:
5068
Error message:
The encryption method is not supported by this protocol version.
I am unable to connect the sagepay server payment.I am completly new about the configuration of sagepay payment.
Some one can please tell me how many parameter I need to pass and What are they are?
How to encrypt the values and then pass the values?
Code:
<form name='sagepay' action='{$pm_sagepay_url}' method='post' onsubmit='this.submit.disabled=true;return true;'>
<input type='hidden' name='VPSProtocol' value='3.00'>
<input type='hidden' name='TxType' value= 'PAYMENT'>
<input type='hidden' name='Vendor' value= 'protxross'>
<input type='hidden' name='Crypt' value= 'TPjs72eMz5qBnaTa'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='{$this->pm_sagepay_business}'>
<input type='hidden' name='item_name' value='".$order->order_description()."'>
<input type='hidden' name='amount' value='".sprintf("%01.2F", ($order->order_total_price-$order->order_fee))."'>
<input type='hidden' name='handling' value='".($order->order_fee)."'>
<input type='hidden' name='return' value='".$_SHOP->root_secured. 'checkout_accept.php?'.$order->EncodeSecureCode()."'>
<input type='hidden' name='notify_url' value='".$_SHOP->root_secured. 'checkout_notify.php?'.$order->EncodeSecureCode()."&setlang={$_SHOP->lang}'>
<input type='hidden' name='cancel_return' value='".$_SHOP->root_secured. 'checkout_cancel.php?'.$order->EncodeSecureCode()."'>
<input type='hidden' name='currency_code' value='{$_SHOP->organizer_currency}'>
<input type='hidden' name='undefined_quantity' value='0'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='no_note' value='1'>
<input type='hidden' name='rm' value='2'>
<input type='hidden' name='invoice' value='{$order->order_id}'>
<div align='right'>
<input type='submit' value='{!pay!}' name='submit2' alt='{!sagepay_pay!}' >
</div>
</form>";
The info added to the form needs to be encrypted you be better off using the guide found here:
http://www.sagepay.co.uk/file/12241/download-document/FORM_Integration_and_Protocol_Guidelines_010814.pdf?token=gMABp5MzTV1BevfFpoTFkrofFWwHXySRM5tzGIdKj3Q
Also this guy has made a basic script for the form i got the main form to send it was the success page i could not get to work but i have now so if you get stuck give me a shout..
https://github.com/tolzhabayev/sagepayForm-php

reset form php value back to original value php

how to reset value with jquery form..my input text value with php. when I edit text and I reset, then back again to the value php..I've tried with jquery reset but input text
lost value.
<form>
<input type='text' id='chk' value='<?php echo $item.$i?>'/><br/>
<input type='text' value='<?php echo $item.$i?>'/><br/>
<input type='text' value='<?php echo $item.$i?>'/><br/>
<input type='reset' id='reset_button' value='reset'/>
</form>
when i edit input text and then i click reset.input text losing value?how to input text back to original value?
thanks..
You could use a form reset button: <input type='reset' value='Reset'/>
If you don't want the button to be visible, you could hide the button and call the click() method to reset the form.
Example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h2>With button:</h2>
<form>
<input type='text' value='Foo'/><br/>
<input type='text' value='Bar'/><br/>
<input type='reset' value='Reset'/>
</form>
<br/>
<br/>
<h2>Without button:</h2>
<form>
<input type='text' id='chk' value='1'/><br/>
<input type='text' value='Foo'/><br/>
<input type='text' value='Bar'/><br/>
<input type='reset' id='reset_button' style='display: none;'/>
<input type='submit' onclick="if ($('#chk').val() == '0') $('#reset_button').click(); return false;" value='Check if 1 (reset if 0)'/>
</form>

When set value of action, post/get don't work

I have form:
echo "
<form action='http://domain.com/' method='get'>
<input type='hidden' name='order_id' value='".$_SESSION['shoppingcart_id']."' />
<input type='hidden' name='account_id' value='".$account_id."' />
<input type='hidden' name='action' value='add' />
<input type='submit' class='form-button' value='Buy' />
</form>
";
and get don't get any results.
http://domain.com/
If I set value of action to empty like:
<input type='hidden' name='action' value='' />
the result is:
http://domain.com/?order_id=xxxxxxxx&acount_id=xxxxxxxxx$action=
I'm confused why with empty action get results, but with action don't get anything!?
p.s. With "post" is the same.

How can I get multiple forms to use the same inputs in php

I have 15 identical PayPal "Buy Now" buttons each driven by its own form on a single php page. Each button has about 20 input variables but only 2 are unique to each item (item_name & item_number). Is there a way to clean up my code and have all the forms use the same input array? Not just the data, the whole string.
Thanks, Wayne
Example:
<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='myemail#mydomain.com'>
<input type='hidden' name='lc' value='US'>
<input type='hidden' name='item_name' value='Modern Art Print'>
<input type='hidden' name='item_number' value='MA024'>*
<input type='hidden' name='button_subtype' value='products'>
<input type='hidden' name='no_note' value='0'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='add' value='1'>
<input type='hidden' name='bn' value='PP-ShopCartBF:btn_cart_SM.gif:NonHostedGuest'>
<input type='hidden' name='on0' value='Select Size'>Buy Print
<select name='os0'>
<option value='11 x 14'>11 x 14 $30.00</option>
<option value='8 x 10'>8 x 10 $20.00</option>
</select>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='option_select0' value='11 x 14'>
<input type='hidden' name='option_amount0' value='30.00'>
<input type='hidden' name='option_select1' value='8 x 10'>
<input type='hidden' name='option_amount1' value='20.00'>
<input type='hidden' name='option_index' value='0'>
<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
</form>
Create a function that builds the form. Example:
function paypalForm( $item_name, $item_number ) {
?>
<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='myemail#mydomain.com'>
<input type='hidden' name='lc' value='US'>
<input type='hidden' name='item_name' value='<?=$item_name?>'>
<input type='hidden' name='item_number' value='<?=$item_number?>'>*
<input type='hidden' name='button_subtype' value='products'>
<input type='hidden' name='no_note' value='0'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='add' value='1'>
<input type='hidden' name='bn' value='PP-ShopCartBF:btn_cart_SM.gif:NonHostedGuest'>
<input type='hidden' name='on0' value='Select Size'>Buy Print
<select name='os0'>
<option value='11 x 14'>11 x 14 $30.00</option>
<option value='8 x 10'>8 x 10 $20.00</option>
</select>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='option_select0' value='11 x 14'>
<input type='hidden' name='option_amount0' value='30.00'>
<input type='hidden' name='option_select1' value='8 x 10'>
<input type='hidden' name='option_amount1' value='20.00'>
<input type='hidden' name='option_index' value='0'>
<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
</form>
<?
}
Assuming you are talking about cleaning the HTML markup, rather than generating the forms at the server side...
You could do it with Javascript, but it is not a good idea to rely on Javascript for your core site functionality, because it can be disabled by the user, and may break in a way you have not predicted in some browser or other.
I think that, since you are submitting the data directly to Paypal and therefore have no control over the server side, the answer to this is probably NO.
If you are talking about cleaning up the PHP code, Rijk van Wel's answer may help.
Please refer to this article: http://www.chami.com/tips/internet/042599i.html
You can create a single form with multiple submit buttons and assign both item_name & item_number as button's value. This way the inputs aren't repeated in the code and you can easily distinguish between submitted forms.
Note: the server-side code in the article is written in ASP, but in PHP it's the same. Just refer to $_POST['buttonNameHere']

Categories