Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 742041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:42:08+00:00 2026-05-14T08:42:08+00:00

I am a bit lost in all these and ” and . in this

  • 0

I am a bit lost in all these “” and ” and . in this statement.
Basically this query is to get all the tagname from table “tag” and display them for the users as checkboxes. If they have clicked ‘submit’ and they missed another field(say the title of a post), it would still have the tag they chose displayed. The part I need help with is the echoing part. It doesn’t seem to remember the tag when they click submit.

      $query4 = "SELECT * FROM tags  ORDER BY tagname";
  $data4 = mysqli_query($dbc, $query4);
  while ($row4 = mysqli_fetch_array($data4)) 
  {
  echo "<li><input type='checkbox' name='postingtag[]'";
  if (!empty($postingtag)){
   echo "value='$postingtag'";
  }
  else{
   echo "value='{$row4['tagID']}'";
  }
  echo ">{$row4['tagname']}</li>";
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:42:09+00:00Added an answer on May 14, 2026 at 8:42 am

    Try this:

    $query4 = "SELECT * FROM tags  ORDER BY tagname";
    $data4 = mysqli_query($dbc, $query4);
    while ($row4 = mysqli_fetch_array($data4)) {
    
     echo "<li><input type='checkbox' name='postingtag[{$row4['tagID']}]' value='1'";
    
     if (isset($postingtag[$row4['tagID']]))
      echo " checked='checked'";
    
     echo "/> {$row4['tagname']}</li>";
    }
    

    $postingtag will be an array that will be populated with tags that have been checked. By adding a discernible index to the $postingtag array you’ll be able to check to see if its be populated and can then set the checked attribute accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a bit lost as to how to explain this, so I will
Bit of an obscure one this. My setup is all running on my local
I'm alright with basic regular expressions, but I get a bit lost around pos/neg
I'm a bit lost with Subversion (1.5+) here: I modified the trunk in my
I'm a bit lost, one of my developer co-worker is doing a drupal website,
I'm starting to learn EJB3 and I'm a bit lost when it comes to
Ok so.. I'm a bit lost. What i have is a window1.xaml just a
as a new ggplot2 user, I am a bit lost with the amount of
I've been working with PHP quiz program and I'm a bit lost on fetching
My table: _id | state | timeStamp I want select all the rows that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.