Jump to content


Photo

please tell me why this does not work


  • Please log in to reply
2 replies to this topic

#1 mATOK

mATOK
  • Members
  • PipPipPip
  • Advanced Member
  • 84 posts
  • LocationToronto, Ontario

Posted 29 September 2006 - 02:37 PM

When I click submit my url changes to

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

instead of

task=2&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>
"Not everything that counts can be counted, and not everything that can be counted counts."

W3 Web Tutorials | Check Your html | CSS layout techniques | ALA | Zen Garden | CSS Links

Navs with flavor | CSS Playground | CSS boxes

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 29 September 2006 - 02:47 PM

Add a hidden field called task instead before your submit button:
<tr><td colspan="2">
<input type="hidden" name="task" value="2" />
<input type="Submit" value="Submit"></td></tr>


#3 mATOK

mATOK
  • Members
  • PipPipPip
  • Advanced Member
  • 84 posts
  • LocationToronto, Ontario

Posted 29 September 2006 - 02:49 PM

THANK YOU VERY MUCH

Any tips on how to improve this code, or do you think its ok as is?
"Not everything that counts can be counted, and not everything that can be counted counts."

W3 Web Tutorials | Check Your html | CSS layout techniques | ALA | Zen Garden | CSS Links

Navs with flavor | CSS Playground | CSS boxes




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users