Announcement

Collapse
No announcement yet.

A tricky problem with forms

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A tricky problem with forms

    I've been working on a page for submitting information, but I've been trying to figure out how to do something specific with it.

    This form is for submitting debates, now there are options to enforce character or date limits on each round of the debate. What I've been trying to do however, is get the form to detect whether or not the option to add date or character limits is selected, and if so, redirect the form to a new form for tacking on that data before submitting it to the database.


    What I've tried so far are things like this

    PHP Code:
    If ($HTTP_POST_VARS['action']=="insert") { 
        if (
    $usecharlimit==or $usedatelimit==1) {
            
    $action="addchar";
        }
    (
    rest of the insert code)

    With an if statement seperating the other part of the form under the addchar action. I've also tried

    PHP Code:
    If ($HTTP_POST_VARS['action']=="insert") { 
        if (
    $usecharlimit==or $usedatelimit==1) {
            (
    form code)
            exit;
        }
    (
    rest of insert code)

    and just had it resubmit the new data to the insert action. Neither method has worked so far, it always skips the redirect and just directly inserts. I'm not really knowlegeable at javascript, and right now I'm running out of ideas, just thought I'd see if anyone here might have any advice for how to fix this problem.

  • #2
    PHP Code:
    if ($action == "insert") {
     if ((
    $option1 == 1) || ($option2 == 1)) {
      
    header('Location: http://www.domain.com/yourscript.php?action=add&param=moreoptions');
      exit;
     } else {
       
    // regular stuff
     
    // endif
    // something else? - like other elseif operators
    // endif 
    HFT Online - Professional computer help ... with a personal touch

    Comment


    • #3
      Originally posted by Techguy1
      PHP Code:
      if ($action == "insert") {
       if ((
      $option1 == 1) || ($option2 == 1)) {
        
      header('Location: http://www.domain.com/yourscript.php?action=add&param=moreoptions');
        exit;
       } else {
         
      // regular stuff
       
      // endif
      // something else? - like other elseif operators
      // endif 
      Hmm, I'll have to try that, but before I do, just to be sure. I won't lose all the post data from the form if I do that will I?

      Comment


      • #4
        if you user header/location, you will, but i guess you could pass to it the variables already sent.
        HFT Online - Professional computer help ... with a personal touch

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X