-3

Good morning how can I open the link called by the action "URLPAYPAL" in a new window? I tried with onclick = "window.open (); but it doesn't work

echo "<a href=# class=\"btn btn-lg btn-block btn-inverse\" onclick=\"";
echo "formid = document.getElementById('gest');\n";
echo "document.getElementById('tabdati2').style.display='';\n";
echo "document.getElementById('tabdati1').style.display='none';\n";
echo "document.getElementById('gest').action='" . URLPAYPAL . "';\n";
echo "formid.email.style.backgroundColor ='#FFFFFF';\n";
echo "var ctrlerr = 0;\n";
echo "var regtel = /^(\d+)$/;\n";
echo "var regema =  /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;\n";
echo "if ((formid.cli.value) != (formid.cli2.value)) {\n";
echo "formid.cli.style.backgroundColor ='#E55B3C';\n";
echo "alert ('Il numero di telefono non coincide!');\n";
echo "ctrlerr=1;\n";
echo "}\n";
echo "if ((formid.cli.value == '') || (formid.cli.value == 'Numero di telefono')) {\n";
echo "formid.cli.style.backgroundColor ='#E55B3C';\n";
echo "alert ('Scrivi il numero di telefono!');\n";
echo "ctrlerr=1;\n";
echo "}\n";
echo "if(!ctrlerr) {\n";
echo "formid.submit();\n";
echo "}\n";
echo "\"> Ricarica<span class=\"fui-arrow-right\"></span> </a>\n";
  • Duplicate https://stackoverflow.com/questions/12939928/make-a-link-open-a-new-window-not-tab – 4givN May 31 '19 at 09:51
  • Unless you are deliberately trying to make life as difficult as possible, I’d recommend a read of https://www.php.net/manual/en/language.basic-syntax.phpmode.php first of all. – 04FS May 31 '19 at 10:08
  • unfortunately it does not work. I wish that when I click on "Ricarica" the link of "URLPAYPAL" opens in a new window. define("URLPAYPAL", "https://test.it/application/B4tlc/index.php?r=pr_cc/CCrecharge4"); – Claudio Jun 06 '19 at 07:39

2 Answers2

0

You can do something like this

window.open(url, '_blank');
  • unfortunately it does not work. I wish that when I click on "Ricarica" the link of "URLPAYPAL" opens in a new window. define("URLPAYPAL", "https://test.it/application/B4tlc/index.php?r=pr_cc/CCrecharge4"); – Claudio Jun 06 '19 at 07:39
0

you can add this to your form

target="_blank"
mr_kiani
  • 43
  • 1
  • 8