Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

dynamic drop down box

Featured Replies

<select name="existing">
     <option value="0">Select One</option>
     <?php //retrive all catagories and add to pull down menu
$sql = 'SELECT * FROM category'; 
$r = mysqli_query($dbc,$sql);
	if (mysqli_num_rows($r)) {
		while ($row = mysqli_fetch_array($r)) {
		echo "<option value=\"{$row['id']}\">{$row['cat_name']}</option>";
		}
	} else {
		echo '<option>Please add and new category</option>';
	}
mysqli_close($dbc); //close connection
		?>   
       </select><br />

 

 

That is the code for my dynamic drop down box, although, it will not work unless the page has been submitted, but this php code isn't in an if(isset($_POST['submitted'])){ if on this page it clean out of it, any ideas what is going wrong?

It would help if we could see the whole code.

 

What errors do you get when it does not work?

 

Since i cannot see a database connection anywhere I can only assume that the connection function is within an if statement that only executes when you post? - That's just a wild guess.

 

Let's see the whole script and I will take a look.

I can't see anything in there that will give an indication of why this is happening.

 

Perhaps you could show some more of the code to give a better idea of what is going on?

 

Paul

  • Author

It would help if we could see the whole code.

 

What errors do you get when it does not work?

 

Since i cannot see a database connection anywhere I can only assume that the connection function is within an if statement that only executes when you post? - That's just a wild guess.

 

Let's see the whole script and I will take a look.

You triggered a brain strom, i had my database connections in the if(isset($_POST['submitted'] if statement, moved it out of it and it worked first time, Thank you.

 

I can't see anything in there that will give an indication of why this is happening.

 

Perhaps you could show some more of the code to give a better idea of what is going on?

 

Paul

 

As stated above, it was in an if that required a page submit, thanks again.

 

 

Ben

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.