Jump to content

Archived

This topic is now archived and is closed to further replies.

mATOK

please tell me why this does not work

Recommended Posts

When I click submit my url changes to

client=4&fname=NAME&lname=LAST&e-mail=NAME.LAST%40SOMEWHERE.com

instead of

[b]task=2[/b]&fname=NAME&lname=LAST&e-mail=NAME.LAST%40SOMEWHERE.com


$sql = "SELECT * FROM Customer ORDER BY Name";
                        $res = mssql_query($sql);
                        if (!$client_select) {
                                echo "<form name=\"Add-Customer\" action=\"borealis-connect.php?task=1\" method=\"get\">";
                                echo "<table border=\"0\"><tr><td>Company</td>";
                                echo"<td><select name=\"client\" onchange=\"document.location='borealis-connect.php?task=1&client='+escape(this.value);\">";
                                while ($customerS = mssql_fetch_array($res)){
                                        echo "<option value=\"".$customerS['CustomerID']."\">".$customerS['Name'];
                                }
                                echo "</td></tr>";
                        }
                        elseif ($client_select) {
                                echo "<form name=\"Add-Customer\" action=\"borealis-connect.php?task=2\" method=\"get\">";
                                echo "<table border=\"0\"><tr><td>Company</td>";
                                $sql2 = "SELECT * FROM Customer WHERE CustomerID = '$client_select'";
                                $res2 = mssql_query($sql2);
                                while ($blah = mssql_fetch_array($res2)) {
                                        echo "<td><select name=\"client\"><option value=\"".$client_select."\">".$blah['Name']."</td>";
                                }?>
                                </tr>
                                <tr><td>First Name</td><td><input type="text" name="fname" size="30" /></td></tr>
                                <tr><td>Last Name</td><td><input type="text" name="lname" size="30" /></td></tr>
                                <tr><td>E-Mail</td><td><input type="text" name="e-mail" size="30" /></td></tr>
                                <tr><td colspan="2"><br /><input type="Submit" value="Submit"></td></tr><?php
                        }?>
                        </table>
</form>

Share this post


Link to post
Share on other sites
Add a hidden field called task instead before your submit button:
[code]<tr><td colspan="2">
<input type="hidden" name="task" value="2" />
<input type="Submit" value="Submit"></td></tr>[/code]

Share this post


Link to post
Share on other sites
THANK YOU VERY MUCH

Any tips on how to improve this code, or do you think its ok as is?

Share this post


Link to post
Share on other sites

×

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.