• <script type="text/javascript">
    function chkradio()
    {
    if(document.getElementById('chkPositive1').checked==true||  document.getElementById('chkNegative1').checked==true||  document.getElementById('chkNeutral1').checked==true)
      {
       var cg;
      }
    else
    {alert("Please select an option for Question 1");
    }
    if(document.getElementById('chkPositive2').checked==true||  document.getElementById('chkNegative2').checked==true||  document.getElementById('chkNeutral2').checked==true)
      {
       var cg;
      }
    else
    {alert("Please select an option for Question 2");
    }
    if(document.getElementById('chkPositive3').checked==true||  document.getElementById('chkNegative3').checked==true||  document.getElementById('chkNeutral3').checked==true)
      {
       var cg;
      }
    else
    {alert("Please select an option for Question 3");
    }
    if(document.getElementById('chkPositive4').checked==true||  document.getElementById('chkNegative4').checked==true||  document.getElementById('chkNeutral4').checked==true)
      {
       var cg;
      }
    else
    {alert("Please select an option for Question 4");
    }
    if(document.getElementById('chkPositive5').checked==true||  document.getElementById('chkNegative5').checked==true||  document.getElementById('chkNeutral5').checked==true)
      {
       var cg;
      }
    else
    {alert("Please select an option for Question 5");
    }
    }
    </script>
    <form action=" " method="post" name="myForm">
    <p style="text-align: left;">
    <span style="color: black;">
    <strong>Q 1. How would you rate the present general business conditions in your area?</strong>
    <input id="chkPositive1" type="radio" value="1" />Positive
    <input id="chkNegative1" type="radio" value="2" />Negative
    <input id="chkNeutral1" type="radio" value="3"  />Neutral
    <br></br><strong>Q 2. Six months from now, what do you think the general business conditions will be there in your area?</strong>
    <input id="chkPositive2" type="radio" value="1" />Positive
    <input id="chkNegative2" type="radio" value="2" />Negative
    <input id="chkNeutral2" type="radio" value="3"  />Neutral
    <br></br><strong>Q 3. What would you say about available jobs in your area right now?</strong>
    <input id="chkPositive3" type="radio" value="1" />Positive
    <input id="chkNegative3" type="radio" value="2" />Negative
    <input id="chkNeutral3" type="radio" value="3"  />Neutral
    <br></br><strong>Q 4. Six months from now, do you think there will be jobs available in your area?</strong>
    <input id="chkPositive4" type="radio" value="1" />Positive
    <input id="chkNegative4" type="radio" value="2" />Negative
    <input id="chkNeutral4" type="radio" value="3"  />Neutral
    <br></br><strong>Q 5. How would you guess your total family income to be six months from now?</strong>
    <input id="chkPositive5" type="radio" value="1" />Positive
    <input id="chkNegative5" type="radio" value="2" />Negative
    <input id="chkNeutral5" type="radio" value="3"  />Neutral
    </span>
    </p>
    <input type="Button" id='backbutton' value="Submit" onclick="chkradio()" />
    
    </form>

    This is the code I have created, I wanted to also track Country Name in such a way that the user need not required to enter that, it should automatically store that information in my database.

Viewing 1 replies (of 1 total)
  • I haven’t tried it, but you could add a hidden field to your form using the PHP geoip_country_code_by_name function if your server is running it:

    <?php
      if(function_exists(geoip_country_code_by_name)) {
        echo '<input type="hidden" name="countrycode" value="' . geoip_country_code_by_name($_SERVER['REMOTE_ADDR']) . '" />';
      }
    ?>

    To add it to your database, you’ll need to add the field via whatever code handles your form submission.

Viewing 1 replies (of 1 total)
  • The topic ‘How to Track Country Name in Form’ is closed to new replies.