Jump to content

Recommended Posts

hello all,

 

I have a rather funky code

 

below is comments_form.php for which i use the include function on my viewItem page.

<?php
// edit form style ONLY in the HTML section enclosed in comment tags below
include("includes/comments-config.php");
if ($commoff != 1) {
?>

<form action="comments/comments_process.php" method="post" style='text-align:center;margin-top:10px;width:500px'>
<?php
// get the page ID and URL and add to form as required inputs
$ret_url = "http://". $_SERVER['SERVER_NAME']. $_SERVER['REQUEST_URI'];
echo "<input type='hidden' name='ret_url' value='". $ret_url. "'/>"; 
echo "<input type='hidden' name='page_id' value='" .$page_id. "' />";
?>

<!--form style is taken from your page style - you MAY edit below here-->
<table cellpadding="3" style="border:1px dotted #666;" width="191px">
<tr><td style="color:#666666;font-size:12px;font-weight:bold;text-align:center;width:91px"><p><?php echo $your_name;?></p></td><td align='left' style="font-size:12px;font-weight:bold;text-align:center;width:100px"><input type="text" style="font-size:12px;font-weight:bold;text-align:center;width:100px" name="name" maxlength="40" /></td></tr>
<tr><td  style="color:#666666;font-size:12px;font-weight:bold;text-align:center;width:91px"><p><?php echo $your_location;?></p></td><td align='right' style="font-size:10px;font-weight:bold;text-align:center;width:100px"><input type="text" style="font-size:12px;font-weight:bold;text-align:center;width:100px" name="locn" maxlength="40"/></td></tr>

<?php
// this section provides the countries drop-down if 'show flags' is active
if ($show_flags == 1) { include("includes/show-countries.php"); }
?>

<?php
// this section provides a 'rating' dropdown input if 'art_rating' is active
if ($art_rating == 1) { include("includes/show-ratings.php"); }
?>

<tr><td colspan="2" style="color:#666666;font-size:12px;font-weight:bold;text-align:center"><p><?php echo $your_comments;?></p></td></tr>
<tr><td colspan="2" style="font-size:12px;font-weight:bold;text-align:center"><textarea cols="30" rows="5" name="comments"></textarea></td></tr>

<?php
// this section provides a captcha image and input if 'captchas' is active
if ($captchas == 1) {
   echo "<tr><td colspan='2' style='font-size:12px;font-weight:bold;text-align:center'><img src='comments/captcha/captcha_image.php' alt='security image' border='0'/></td></tr><tr>";
   echo "<td colspan='2' valign='top' align='right' style='font-size:10px;font-weight:bold;text-align:center'><input type='text' name='secure_match' size='6' style='background-color:#eee;'/></td></tr>";
}

?>

<tr><td colspan='2' align='right' style='font-size:10px;font-weight:bold;text-align:center'>
<input style="margin:2px; background-color:#9999cc;" type="submit" name="submit" value="<?php echo $form_submit;?>" />
</td></tr></table>
</form>
<!--do not edit below here-->
<?
}
?>

 

however when trying to make it jump to a standalone window, none of the info translates into the form:

 

ie.

 

?>
<a href="/comments/comments_form.php" target="page" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=410,left=50,top=50,titlebar=yes')">View Similar</a>
<?php

 

do i need to include any other code?

If you want an easy way to pass the variables to the form via a hyperlink, you must append the hyperlink with GET variables in the form:

 

?var=value&var2=value2 ...

 

Inside your script that will accept the vars/values, you will validate the values of each var, but in order to use these vars and values you must use:

 

$newVar = $_GET['var'];

$newVar2 = $_GET['var2'];

 

Hope I understood what you were asking/needing, and hope this makes sense if it does.

Address bar? Ure just hiding it with javascript and it doesnt matter. Just append those variables:

 

<a href="/comments/comments_form.php?p=v&p2=v2" target="page" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=410,left=50,top=50,titlebar=yes')">View Similar</a>

And a definite final Question! lol

 

Can anyone see how to get around this fiasco below:

 

?>
<a href="/comments/comments_form.php?<?php var1=http://'. $_SERVER[sERVER_NAME]. $_SERVER[REQUEST_URI].'&var2='.$row[sku].' ?>" target="page" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=410,left=50,top=50,titlebar=yes')">View Similar</a>
<?php

U really need to pass the full url to the get variable? Anyway:

 

<a href="/comments/comments_form.php?<?php echo 'var1=http://' . $_SERVER[sERVER_NAME] . $_SERVER[REQUEST_URI] . '&var2=' . $row[sku]; ?>" target="page" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=410,left=50,top=50,titlebar=yes')">View Similar</a>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.