1

i want to open a twitter bootstrap model by an hyperlinnk tag with href to an external file, i want to send some data to the file by GET or POST... i have no idea how to do that by POST by i tried this by GET, but its some how not working completly, here is what i tried...

      $get_forms="mhk_resources/get_quote_forms.php?inputInsuranceType=$inputInsuranceType&addPartner=$addPartner&inputAge=$inputAge&inputGender=$inputGender&inputSmoked=$inputSmoked&inputCAmount=$inputCAmount&inputChildren=$inputChildren&inputAgep=$inputAgep&inputGenderp=$inputGenderp
&inputSmokedp=$inputSmokedp&inputCAmountp=$inputCAmountp";
<a data-target='#myModal' href='<?php echo $get_forms;?>' role='button' class='btn' data-toggle='modal'>Launch demo modal</a>

but its not working, if i used just

 href='mhk_resources/get_quote_forms.php?inputInsuranceType=Life' 
then it works fine, but how can i send the other variables... ?
mhk
  • 436
  • 6
  • 14

1 Answers1

0

Try encode the ampersand & into it's HTML entity &amp;, like this:

$get_forms="mhk_resources/get_quote_forms.php?inputInsuranceType=$inputInsuranceType&amp;addPartner=$addPartner&amp;inputAge=$inputAge&amp;inputGender=$inputGender&amp;inputSmoked=$inputSmoked&amp;inputCAmount=$inputCAmount&amp;inputChildren=$inputChildren&amp;inputAgep=$inputAgep&amp;inputGenderp=$inputGenderp&amp;inputSmokedp=$inputSmokedp&amp;inputCAmountp=$inputCAmountp";

HTML entities are parsed inside HTML attributes so it will work when you echo inside the href of the anchor.

Update: I've found a 2y old question which supports what I just said: Do I encode ampersands in <a href...>?

Community
  • 1
  • 1
RaphaelDDL
  • 4,452
  • 2
  • 32
  • 56
  • i used the code you suggested but it still does NOT load the file... the php variable has the & encoding, and generated HTML shows '&' but link still not loading content of file in modal... – mhk Jul 04 '13 at 17:09
  • i tried to put the code on html section of jsfiddle... here's the link [JSFIDDLE](http://jsfiddle.net/yeQ3q/) – mhk Jul 04 '13 at 17:21