Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open the real url in new window??

Status
Not open for further replies.

hisham

IS-IT--Management
Nov 6, 2000
194
I have the following code, when I click on the url entry i.e. somewhere.com, this lead me to my server:
What must I do to open the real url somewhere.com in a new window?

Thanks in advance

-----------------------------------
<?php
include (&quot;./common.php&quot;);
$sFileName = &quot;EntryView.php&quot;;
$sEntryViewErr = &quot;&quot;;
$sAction = get_param(&quot;FormAction&quot;);
$sForm = get_param(&quot;FormName&quot;);
//-- handling actions
switch ($sForm)
{
case &quot;EntryView&quot;:
EntryView_action($sAction);
break;
}
<?
function EntryView_action($sAction)
{
global $db;
global $sForm;
global $sEntryViewErr;
$sParams = &quot;&quot;;
$sActionFileName = &quot;Entries.php&quot;;
$sParams = &quot;?&quot;;
$sParams .= &quot;address=&quot; . tourl(get_param(&quot;Trn_address&quot;)) . &quot;&&quot;;
$sParams .= &quot;name=&quot; . tourl(get_param(&quot;Trn_name&quot;)) . &quot;&&quot;;
$sParams .= &quot;category_id=&quot; . tourl(get_param(&quot;Trn_category_id&quot;));
$sWhere = &quot;&quot;;
$bErr = false;
if($sAction == &quot;cancel&quot;)
header(&quot;Location: &quot; . $sActionFileName . $sParams);
//-- Create SQL statement
$sSQL = &quot;&quot;;
if(strlen($sEntryViewErr)) return;
//-- Execute SQL query
$db->query($sSQL);
header(&quot;Location: &quot; . $sActionFileName . $sParams);
}
function EntryView_Show()
{
global $sFileName;
global $sAction;
global $db;
global $sForm;
global $sEntryViewErr;
global $styles;
$sWhere = &quot;&quot;;

$bPK = true; //-- primary key indication
//-- begin block of initialization variables
$flditem_id = &quot;&quot;;
$fldname = &quot;&quot;;
$fldcategory_id = &quot;&quot;;
$fldemail = &quot;&quot;;
$fldurl = &quot;&quot;;
//-- end block
?>
<table >
<form method=&quot;POST&quot; action=&quot;<?= $sFileName ?>&quot; name=&quot;EntryView&quot;>
<tr><td ><font >Entry</font></td></tr>
<? if ($sEntryViewErr) { ?> <tr><td ><font><?= $sEntryViewErr ?></font></td></tr><? } ?>
<?
if($sEntryViewErr == &quot;&quot;)
{
//-- Get primary key and form parameters
$fldname = get_param(&quot;name&quot;);
$fldcategory_id = get_param(&quot;category_id&quot;);

$Trn_category_id = get_param(&quot;category_id&quot;);
$pitem_id = get_param(&quot;item_id&quot;);
}
else
{
//-- Get primary key, form parameters and form's fields
$flditem_id = strip(get_param(&quot;item_id&quot;));
$fldname = get_param(&quot;Trn_name&quot;);
$Trn_name = get_param(&quot;Trn_name&quot;);
$Trn_category_id = get_param(&quot;Trn_category_id&quot;);
$pitem_id = get_param(&quot;PK_item_id&quot;);
}
if( !strlen($pitem_id)) $bPK = false;
$sWhere .= &quot;item_id=&quot; . tosql($pitem_id, &quot;Number&quot;);
$PK_item_id = $pitem_id;
$sSQL = &quot;select * from items where &quot; . $sWhere;
if($bPK && !($sAction == &quot;insert&quot; && $sForm == &quot;EntryView&quot;))
{
$db->query($sSQL);
$db->next_record();

$flditem_id = $db->f(&quot;item_id&quot;);
$fldname = $db->f(&quot;name&quot;);
$fldcategory_id = $db->f(&quot;category_id&quot;);
$fldemail = $db->f(&quot;email&quot;);
$fldurl = $db->f(&quot;url&quot;);
}
else
{
if($sEntryViewErr == &quot;&quot;)
{
$fldname = tohtml(get_param(&quot;name&quot;));
$fldcategory_id = tohtml(get_param(&quot;category_id&quot;));
}
}//-- Set lookup fields
$fldcategory_id = dlookup(&quot;categories&quot;, &quot;name&quot;, &quot;category_id=&quot; . tosql($fldcategory_id, &quot;Number&quot;));
if($sEntryViewErr == &quot;&quot;)
{
$fldemail=&quot;<a href=mailto:&quot; . $fldemail . &quot;>&quot; . $fldemail . &quot;</a>&quot;;
}
//-- show fields
?>
<tr>
<td >
<font >Name</font>
</td>
<td >
<font><?=tohtml($fldname)?> </font>
</td>
</tr>

<tr>
<td >
<font >Category</font>
</td>
<td >
<font ><?=tohtml($fldcategory_id)?> </font>
</td>
</tr>
<tr>
<td >
<font >E-mail</font>
</td>
<td >
<font ><?=$fldemail?> </font>
</td>
</tr>
<tr>
<td >
<font >URL</font>
</td>
<td >
<font ><a href=&quot;<?=$db->f(&quot;url&quot;) ?>&quot;><font ><?= $fldurl ?></font></a> </font>
</td>
</tr>
 
to open the link in a new window, just put in the a tag, the target param.

<a href=&quot; target=&quot;_blank&quot;>

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top