Since you want to do this with HTML, this will require some Javascript as well. I rather suspect that somthing like

<select id="country" onchange="changestatelist()"> .... <script> function changestatelist() { ...

will be involved.

w3schools has a tutorial.

What it boils down to: If you make a website, you'll need to learn HTML, Javescript and CSS in addition to your backend language (perl, php, python or nodejs).

Edit: As a sidenote, especially for my friends in th USA: Not all countries have states or regions, especially the smaller ones. Monaco and Liechtenstein are small enough for a single postal worker to know all the adresses. And is Sealand ever gets recognized, you can tour the whole country in about 15 minutes flat.

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

In reply to Re^2: how to make dependent drop down in perl script by cavac
in thread how to make dependent drop down in perl script by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.