We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36582
    • 463 Posts
    Wonder if any of you good people can help here? I’ve got 2 select boxes on my contact form configured as follows

    		<label for="cfRegarding">Regarding:</label>
    		<select name="subject" id="cfRegarding" eform="Form Subject::1">
    			<option value="New Sports Surface">New Sports Surface</option>
    			<option value="Sports Surface Refurbishment">Sports Surface Refurbishment</option>
    			<option value="Playground Surface">Playground Surface</option>
    <option value="Garden Surface">Garden Surface</option>
    		</select>
    
    <label for="cfLocation">Location:</label>
    		<select name="location" id="cfLocation" eform="Location::1">
    <option selected>Please tell us where you are...</option>
    <option>England</option>
    <option>-South East</option>
    <option value="Bedfordshire">--Bedfordshire</option>
    

    Obviously I’ve not pasted the whole list here!

    And I’m getting the following error;

    PHP error debug
    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: /******/****/********/******/*********/assets/snippets/eform/eform.inc.php
    Line: 843
    Line 843 source: foreach ($attributes as $k => $v)

    I just don’t understand what the problem is?
      Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
      • 4310
      • 2,310 Posts
      Chris,
      eForm is looking for a ’value’ for each ’option’, in your ’Location’ drop-down they’re not all matching pairs.
        • 36582
        • 463 Posts
        Don’t think that’s the problem.

        If I change;

        <label for="cfLocation">Location:</label>
        		<select name="location" id="cfLocation" eform="Location::1">


        to

        <label for="cfLocation">Location:</label>
        		<select name="[font=Verdana]subject[/font]" id="cfLocation" eform="Location::1">


        I don’t get the problem (but I obviously get a problem when trying to send the form)
          Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
          • 30223
          • 1,010 Posts
          Sigh... As Dacid said th eproblem lies in missing ’value’ attributes in the options elements. Changing the name of the locations select element will not make any difference, even if you don’t get the php error. (which likely happens because you then have two ’subject’ selects )

          <label for="cfLocation">Location:</label>
          		<select name="location" id="cfLocation" eform="Location::1">
          <option selected="selected" value="">Please tell us where you are...</option>
          <option value="England">England</option>
          <option value="South East">-South East</option>
          <option value="Bedfordshire">--Bedfordshire</option>
          

            • 36582
            • 463 Posts
            Thank you for your patience.

            First problem was this

            <option selected>Please tell us where you are...</option>


            Which I removed.

            Second problem was further down in the list

            <option value=>-Yorkshire</option>
            - a stray value=

            Which I corrected.

            Some options don’t need values as they are purely for organising lists of counties - sorry if I misled anyone - I looked through everything 2 or 3 times and couldn’t see the problem so I wrongly assumed it was because of using 2 select boxes. Sigh

              Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk