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

  • SEARCH
  • Home
  • 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 8666583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:46:01+00:00 2026-06-12T17:46:01+00:00

please help me. I include here (see bellow) the Combobox script for INSERTING FORM

  • 0

please help me. I include here (see bellow) the Combobox script for INSERTING FORM
I have a Form of Adding a new product. One of option is to select what Category. So, Combobox is for selecting Category from.

<TD>

<?php

$sql="SELECT categories.id as id, categories.name as name FROM categories";
$result=mysql_query($sql) or die(mysql_error());

$options="";

while ($row=mysql_fetch_assoc($result)) {
$id=$row["id"];
$thing=$row["name"];
$options.= " <OPTION VALUE=".$id.">".$thing.'</option>';
    }

?>

<select name="CATEGORY" onClick=”submitCATEGORY();”>
 <option value="0">Select Category
 <?php echo $options;?></option>

</select>   
</TD>

Now, I would like to have an EDIT FORM using the same script as for Inserting data in database using combobox.

<?php echo $CATEGORY; ?> this script is for retrieving the data from database.

please help me to find a way, when I want to Edit a PRODUCT information to get combobox with option I selected during the inserting the data…
I could succeed to fill the data for the name of products and other information, only Combobox is empty. I hope you could understand what I want to achieve! Thank you in advance for your time!!!

See bellow what I tried but did not succede:

<?php
$sql="SELECT categories.id as id, categories.name as name FROM categories";
$result=mysql_query($sql) or die(mysql_error());

$options="";
while ($row=mysql_fetch_assoc($result)) {
$id=$row["id"];
$thing=$row["name"];
$options.= " <OPTION VALUE=".$id.">".$thing.'</option>';
        }
    ?>
    <select name="CATEGORY" onClick=”submitCATEGORY();”>
<option value="<?php echo $CATEGORY; ?>">
<?php echo $options;?></option>
</select>
</TD>
  • 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-06-12T17:46:02+00:00Added an answer on June 12, 2026 at 5:46 pm

    Try the following in your edit page,

    <?php
     $CATEGORY = 3; //from DB table, consider 3 as category id for sample
    
     $sql="SELECT categories.id as id, categories.name as name FROM categories";
     $result=mysql_query($sql) or die(mysql_error());
    
     $options="";
     while ($row=mysql_fetch_assoc($result)) {
        $id=$row["id"];
        $thing=$row["name"];
        $isSel = ($CATEGORY == $id)?"selected":'';
        $options.= " <OPTION VALUE='$id' $isSel>$thing</option>';
     }
     ?>
     <select name="CATEGORY" onClick=”submitCATEGORY();”>
     <option value="<?php echo $CATEGORY; ?>">
     <?php echo $options;?></option>
     </select>
     </TD>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please i need your help with how to include INDEXES in my tables, i've
Please help me to improve the following script: http://jsfiddle.net/n9BkM/8/ I need the following fucntionality:
please help a newbie in Rails :) I have protect_from_forgery call (which is given
I am new to this website and new to Jquery. So seniors please help
I am new to java regex.Please help me. Consider the below paragraph, Paragraph :
I have this code, but I don't see where I went wrong here. It
please help me understand what's going on in here and whether it should work
Please help me I am New in PHP and since last 5 Hours i
Please help me somebody to convert unicodestring into string This is how i am
Please help me with this update query. I COMPLETELY understand how redundant this is

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.