Jump to content
Latest News: (loading..)

Recommended Posts

17 hours ago, raiwa said:

I don't know why it doesn't show the error. Maybe it's because the script is accessed via javascript? But if 'state_name' is not in the array listed, it is not set and doesn't exist.

Meanwhile it's always better to echo variables where they are used:


  require('includes/application_top.php');

  echo '$_POST' . print_r($_POST);
  $country_id = $_POST['country_id'];
  $state_name = $_POST['state_name'];

  $check_query = tep_db_query("select count(*) as total from zones where zone_country_id = '" . (int)$country_id . "'");

 

echo '$_POST' shows $_POST as text (I think you have made a mistake).
echo $_POST shows Array

Eventually, echo $_POST['state_name'] shows the variable selected result (13).

print_r($_POST) shows the array : Array ( [country_id] => 21 [state_name] => 13 )

NB: print_r($_POST) don't need echo to be displayed.

 

Frankly it's a lot of quibbles for not much ...

If I write it this way it looks better for you ? :

echo tep_draw_input_field('state', (isset($state_name) ? $state_name : ''), 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');

 


Osc v2.3.4 BS "custom"

Share this post


Link to post
Share on other sites

I do the text echo to see where it is displayed even there is no variable content, it's just my habit.

I would say correct is to apply the isset check where the ·POST variable is used:

  $state_name = (isset($_POST['state_name']) ? $_POST['state_name'] : '');

$state name is always defined in your code, no need to check it in the menu.

Share this post


Link to post
Share on other sites
Quote

1. For those who has got 2.3.4.1 CE Frozen version and/or fontawesome 5 :

Edit includes/modules/header_tags/ht_country_state_jquery.php file and find this code :

I have no such file.  I am using 2.3.4.1 CE

Downloaded and installed on May 26th.  Do I need to upgrade already?  :ohmy:

I've installed this contribution and I have no dropdown box for the state field at all.  Only the country.

Please advise!

- Andrea

Share this post


Link to post
Share on other sites

Ignore my post.  Been staring at the screen too long today.  I'm good.

- Andrea

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×