<!DOCTYPE html>
 <h2>Wholesale and Dealer Inquiries Form</h2>
<table align="center">
<form action="<?php echo $block- 
>getBaseUrl().'wholesaleapplication/index/post/';?>" method="post">
        <td><label> Business Name </label></td>
        <td> <input type="text" name="name"></td>
         <td><label> Contact Name </label></td>
         <td><input type="text" name="cname"></td>
         <td> <label> E-mail </label></td>
         <td><input type="email" name="email"></td>
         <td> <label> Address </label></td>
         <td><input type="text" name="address">
         <label> Street Address </label></td>
         <td><input type="text" name="address2">
         <label> Street Address  line 2</label></td>
         <td><input type="text" name="city">
         <td><input type="text" name="state">
         <td><input type="text" name="zipcode">
         <label>postal zip/code</label></td>
         <td><input type="text" name="areacode">
         <label>area code</label></td>
         <td><input type="text" name="phonenumber">
         <label>phone number</label></td>
         <td> <label class="form-label form-label-left form-label-auto" id="label_9" for="input_9"> Website </label></td>
         <td><input type="text" name="website"></td>
         <td> <label> Reseller Permit </label></td>
         <td><input type="text"  name="reseller"></td>
         <td> <label> Description of Business </label></td>
         <td><textarea  name="description" ></textarea></td>
         <td> <label> Additional Questions and Comments </label></td>
         <td><textarea name="additional"  ></textarea></td>
         <td> <label> click to edit </label></td>
         <td><input type="file"></td>
     <td><button  type="submit" name="submit">


country dropdowncode

<?php $_countries = 
toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
<select name="country" id="country">
    <option value="">-- Please Select --</option>
    <?php foreach($_countries as $_country): ?>
        <option value="<?php echo $_country['value'] ?>">
            <?php echo $_country['label'] ?>
    <?php endforeach; ?>
 <?php endif; ?>

i want drop down near zip code in phtml file where to keep this country code?

  • you have tried Magento 1 code> – Amit Bera Feb 21 '19 at 7:28
  • can you please share me magento2 code – Ashish Ramchandani Feb 21 '19 at 7:29

Magento already has a block class which is available to provide country dropdown.

On your phtml files call the block and you will get country dropdown

<?php $countryBlock = $block->getLayout()->createBlock('Magento\Directory\Block\Data');?>

<?= $countryBlock->getCountryHtmlSelect($defValue = null, $name = 'country_id', $id = 'country', $title = 'Country');?>

You can set default $defValue,$name,$id as per as your wise.

| improve this answer | |
  • i have to keep this code in sayhello.phtml file right? – Ashish Ramchandani Feb 21 '19 at 7:38
  • yes, just you have to paste this code – Amit Bera Feb 21 '19 at 7:40
  • thankyou it works – Ashish Ramchandani Feb 21 '19 at 7:40
  • now i have to pass this in post varilable so what will be the name of the variable – Ashish Ramchandani Feb 21 '19 at 7:42
  • +1 simple and nice @AmitBera – Prathap Gunasekaran Feb 21 '19 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.