Jezza22 Posted March 26, 2009 Share Posted March 26, 2009 I would like to open a new window and from the parent window pass the values from a HTML select tag. The problem is when the new/child window opens the variables that are being passed using $_POST are always a one value behind? I think it is because the values for the HTML select tags are set when I submit the page and therefore I need to have some kind of function that gets the values and sets them into a variable in the page before I submit? Please help here's the code: - <html> <div id="boxed"> <form name='search' method='post' action='search.php<?php echo "?menu=" . $_GET['menu'];?>' onsubmit="window.open('http://localhost/pyramid/fpdf/print.php?<?php echo $_POST['Account_From'] ."&". $_POST['Account_To'];?>')"> <fieldset id='Print_Options'> <legend>Print Options</legend> <table> <tr><td>Account From:</td><td><?php if ($result = mysql_query("SELECT idAccounts_File, Company_Name FROM accounts_file;")) { if (mysql_num_rows($result)) { echo "<select name='Account_From'>"; while ($row=mysql_fetch_array($result)) { if ($row['idAccounts_File'] == $_SESSION['idAccounts_File']) { echo "<option value='{$row['idAccounts_File']}' selected='selected'>{$row['Company_Name']}</option>";} else { echo "<option value='{$row['idAccounts_File']}'>{$row['Company_Name']}</option>";} } } } echo "</select>"; ?> <tr><td>Account To:</td><td><?php if ($result = mysql_query("SELECT idAccounts_File, Company_Name FROM accounts_file;")) { if (mysql_num_rows($result)) { echo "<select name='Account_To'>"; while ($row=mysql_fetch_array($result)) { if ($row['idAccounts_File'] == $_SESSION['idAccounts_File']) { echo "<option value='{$row['idAccounts_File']}' selected='selected'>{$row['Company_Name']}</option>";} else { echo "<option value='{$row['idAccounts_File']}'>{$row['Company_Name']}</option>";} } } } echo "</select>"; ?> <input type="submit" name="Print" Value="Print" class="Ok" title="Print Report"/> Link to comment https://forums.phpfreaks.com/topic/151311-getting-setting-a-html-select-value-into-varable-on-the-same-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.