Appnitro Software Forums » MachForm

Dropdown Links

(4 posts)
  • Started 2 months ago by reprocessor
  • Latest reply from reprocessor

  1. Hi all,

    I was wondering if you can make the options in a dropdown list link to another page. For example; there'd be 20 trades in the dropdown and when you select one and click submit it will take you to the appropriate page for that trade. I've seen the post that will allow you to do this for email (I think it was Anthony Best's post - on the sticky list) and would like to know how to do it for links as my php aint that good ;)

    Cheers,

    Phil

    Posted 2 months ago #
  2. Hi Phil,

    Pretty simple actually. Let's take an example with this form:
    http://www.appnitro.com/forms/view.php?id=19

    That form is having form_id = 19 and the "Redirect To" dropdown is having id = "element_2" (view the HTML source to see this)

    The dropdown is having some values:

    <option value="1" >Google</option>
    <option value="2" >Yahoo</option>
    <option value="3" >MSN</option>

    Now, the plan is to redirect to either Google or Yahoo or MSN, based on the selected dropdown.

    Edit your includes/post-functions.php file, around line 1173 - 1175 you'll find this code:

    if(!empty($form_review)){
    	$process_result['review_id']   = $record_insert_id;
    }

    Exactly below the above code, add this code:

    if($form_id == 19){
    	switch ($user_input['element_2']){
    		case 1 : $redirect = 'http://www.google.com'; break;
    		case 2 : $redirect = 'http://www.yahoo.com'; break;
    		case 3 : $redirect = 'http://www.msn.com'; break;
    	}
    
    	$process_result['form_redirect'] = $redirect;
    }

    That would do it.

    Of course, you will need to adjust the above code with your own values.

    Note: The code above only work for form with "Form Review" disabled.

    Posted 2 months ago #
  3. Thanks for this Yuinar - I'll give it a try soon and will let you know how i get on :)

    Cheers,

    Phil

    Posted 2 months ago #
  4. Thanks Yuniar - this worked a treat ;)

    Best regards,

    Phil

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.