e1seix Posted April 26, 2008 Share Posted April 26, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/ Share on other sites More sharing options...
sKunKbad Posted April 26, 2008 Share Posted April 26, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-527994 Share on other sites More sharing options...
e1seix Posted April 26, 2008 Author Share Posted April 26, 2008 I do understand what you me, however I'm a bit confused as to how to include the variables in the hyperlink when the new window doesn't have an address bar, it's just a form (see javascript) Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-528013 Share on other sites More sharing options...
Fadion Posted April 26, 2008 Share Posted April 26, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-528025 Share on other sites More sharing options...
e1seix Posted April 26, 2008 Author Share Posted April 26, 2008 nice one! Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-528040 Share on other sites More sharing options...
e1seix Posted April 27, 2008 Author Share Posted April 27, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-528047 Share on other sites More sharing options...
Fadion Posted April 27, 2008 Share Posted April 27, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/103082-translating-information-to-new-window-form/#findComment-528052 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.