PDA

View Full Version : quick php help - should be an easy fix



Jon101
12-19-2007, 05:03 PM
how would i make this open in a new window?

<?php
if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
}

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . "\n";
?>


Thanks much!
Jon

BLiZZaRD
12-19-2007, 05:08 PM
You can use the Location: header..



header("Location: http://yoursite.com/newpage.php");


But I am not sure if you want this as part of the if/else or when the button is pressed...

Jon101
12-19-2007, 05:11 PM
Actually, whats happening is that this is a peice of Oscommerce's cart, and for what ever reason since it is being run out of an iframe the paypal payments wont function properly, so i figured if when they clicked "Confirm Order" it would bring a popup to the paypal site, which should work... rather than just loading it in the iframe, which isnt working...

Basically im just trying to do something like <target="_blank"> except in php

BLiZZaRD
12-19-2007, 05:33 PM
Oh, well.. you CAN do it in php, but I find JS to handle "pop-ups" a lot better..



<script language="JavaScript">
<!-- //
function wo(url, name, bits) {
newWin=window.open(url, name, bits);
newWin.focus();
}
// -->
</script>

Jon101
12-19-2007, 05:38 PM
Oh, so where exactly should i place it in the code?

It's kind of confusing because its not calling a specific page, rather a "payment module"

Or at least that's what i think is happening.


Also, this is just a segment of code... the page is rather long.

BLiZZaRD
12-19-2007, 06:45 PM
You can use the above code, changed to your attributes, in the <head>
then in the <body> you call it like so:



<a href="popup.html" onclick="return wo('popup.html')"
>Link to popup</a>

Jon101
12-19-2007, 06:57 PM
ALright cool, but the code above will work in php?

BLiZZaRD
12-19-2007, 07:12 PM
Yup. It is just basic JS for a pop up.

Jon101
12-19-2007, 07:51 PM
alrightie, thanks for the help!