Form redirection based on user input?

Results 1 to 2 of 2

Thread: Form redirection based on user input?

  1. #1
    Join Date
    Dec 1969

    Default Form redirection based on user input?

    Here is the problem...<BR>I am making an admin section of a site so that a customer can modify and view the contents of the database that holds products, customer info and more.<BR><BR>I have 4 tables in a database that I want to allow the client to be able to view, modify, add and delte records in.<BR><BR>I have thought through the code that can actually display and allow for modification of the table data, but the part that I am having problems with is the page that asks the client to choose what they want to view or modify.<BR><BR>I have tried radio buttons for the tables and a dropdown box for the actions, but am not sure that this is the best way to go?<BR><BR>I want the client to check or click a button for the area they want to modify or view (the table) and then click a button or another radio box to choose the action to perform (view/modify/add/delete). I am not sure if I should use If statments (which are very long) or put the values of the form fields into variables or another method.<BR><BR>I eventually want to send the user to a page that will allow them to do the action they want on the table they chose.<BR><BR>Any ideas on how to best do this would be a big help.<BR>I have looked but don&#039;t seem able to find an article on conditional form redirecting (if that describes it?).<BR><BR>Thank you for any help.

  2. #2
    Join Date
    Dec 1969

    Default I'd make the actions separate..

    ...but then figure out how to write "generic" code that can work with any of that tables. That shouldn&#039;t be too hard.<BR><BR>So I&#039;d use radio buttons for the table choice and then buttons for the actions. Like this:<BR><BR>&#060;FORM Name="Choices" Method=Post&#062;<BR>First choose a table:<BR>&#060;INPUT Type=Radio Name="TableName" Value="cats" CHECKED&#062; Cat Crazies<BR>&#060;INPUT Type=Radio Name="TableName" Value="dogs"&#062; Dog Diggers<BR>&#060;INPUT Type=Radio Name="TableName" Value="horses"&#062; Pony Purists<BR>&#060;P&#062;<BR>Then choose which action you want to perform:<BR>&#060;INPUT Type=Button Value="View info" onClick="go(&#039;view&#039;);"&#062;<BR>&#060;INP UT Type=Button Value="Edit records" onClick="go(&#039;edit&#039;);"&#062;<BR>&#060;INP UT Type=Button Value="Add more" onClick="go(&#039;add&#039;);"&#062;<BR>&#060;/FORM&#062;<BR><BR>&#060;SCRIPT Language=JavaScript&#062;<BR>function go(doWhat)<BR>{<BR> var frm = document.Choices;<BR> frm.action = doWhat + ".asp";<BR> frm.submit( );<BR>}<BR>&#060;/SCRIPT&#062;<BR>**********************<BR><BR>All there is to it.<BR><BR>I&#039;d lump delete and modify together as Edit. Because you will sure show the info first and then accept either changs and then an "Update info" button or a "Delete this record" button. Yes, you can use multiple Submit buttons...or pull the same thing as above code, again.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts