NameSilo

Conditional "target=_blank" ?

Spaceship Spaceship
Watch

dabb

Established Member
Impact
7
I have a form and 90% of the time I want the results to pop up in a new browser window. However, sometimes under certain circumstances I want the results to go ahead and appear in the current window instead of opening a new browser window. Is there any way to implement this sort of conditional browser window control in the forms action PHP file?

Thanks!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
I am not sure how easy this would be to implement into your script, but something like this would work.

PHP:
<?php if ($value == true): ?>

<a href="link.html" target="_blank">link</a>

<?php else: ?>

<a href="link.html">link</a>

<? php endif; ?>

Hope that helps. :)
 
0
•••
The problem is that it is form results that I either want to show in a new window (ie: show a page from another website in a new window leaving the form on my site in the original window), or redisplay the form in the same window with an error message if bogus parameters are entered.

So I need to make this decision on the fly from the forms action script.
 
0
•••

We're social

Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back