Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP数据库中显示州id中的城市_Php_State_Show_City - Fatal编程技术网

在PHP数据库中显示州id中的城市

在PHP数据库中显示州id中的城市,php,state,show,city,Php,State,Show,City,我正在尝试制作一个php网站 在注册页面中,用户必须选择状态(选择输入),然后在选择状态后将显示城市输入 这是我的工作,但不是工作,我需要正确的或其他解决方案来修复它,请: > $states = get_states(); > > if($states == NULL) > die('Problem'); > > $scount = count($states); > if($scount

我正在尝试制作一个php网站

在注册页面中,用户必须选择状态(选择输入),然后在选择状态后将显示城市输入

这是我的工作,但不是工作,我需要正确的或其他解决方案来修复它,请:

>     $states = get_states();
>     
>     if($states == NULL)
>       die('Problem');
>     
>     $scount = count($states);
>     if($scount == 0)
>       die('No States');
//******************



您能发布
$\u post
变量的
var\u dump
get\u regions\u by\u state
函数的主体吗?您会得到什么错误?基本调试请..:\如果不是您在发布此问题时输入的错误,则您正在尝试分配,而不是比较,将第二个if语句更改为
$\u POST['state']==$state->name
。现在可以了,但我如何加载页面本身。isset不起作用?能否发布
$\u post
变量的
var\u dump
以及
get\u regions\u by\u state
函数的主体?会出现什么错误?基本调试请..:\如果不是您在发布此问题时输入的错误,则您正在尝试分配,而不是比较,将第二个if语句更改为
$\u POST['state']==$state->name
。现在可以了,但我如何加载页面本身。isset不工作吗?
 <?php
    if(isset($_POST['state']))
  {
      for($i=0; $i < $scount; $i++)
      {
          $state = $states[$i];
          if($_POST['state'] = $state->name)
          {
              $regions = get_regions_by_state($state->id);

              if($regions == NULL)
                  die('Problem');

                $rcount = count($regions);

                if($rcount == 0)
                  die('No regions');

              for ($i=0; $i < $rcount; $i++)
              {
                  $region = $region[$i];
                  echo "<option value=\"$region->id\">$region->name</option>";        
              }

          }
        }         
  }
  ?>