Hello friends
please tell how to add ssubcategories and editing in a single page
please provide code if u have
i worked on that but iam getting errors
please help me in solving the problem

hello
this is same as add/edit category..
the only difference is we are showing categories and sub categories..thats all..remaining is same...
k try again, you will get...

Hi,
What you are exactly trying to say?

Let me know briefly or shortly.

I require the add subcategory and edit subcategory in a single page
and i want to add category and add subcategory with a single table
(if suppose i put the category parentid=0 and for subcategory parentid =1 )
please tell the code i have written the code for addcategory but iam unabling to write the code for addsubcategory please

Thanks in advance
Bye

hi rakesh,
for subcategory u first create table with prid,parentid name,title..etc
and then write query as

$qry2="INSERT INTO `cf_posts`(`parentid`,`title`,`content`,`dateadded`,`author`) values('".$_POST['selcategory']."','".$_POST['title']."','".$_POST['description']."',now(),'admin')";
			 $res2=mysql_query($qry2) or die(mysql_error());

selcategory is the selection box which has category list

<select name="selcategory" class="box" id="selcategory">
                  <option value="">------Selectcategory-------</option>
                  <?
 $qry4="SELECT * FROM cf_forums WHERE parentid=0";
					$res3=mysql_query($qry4) or die(mysql_error());
				while($row4=mysql_fetch_array($res3))
				{
					?>
                  <option class="red" value="<?=$row4['forumid']?>" >
                  <?=$row4['title']?>
                  </option>
                    </select>

thats it foe adding for edit in manage page u will have a edit like

<td height="22" colspan="2" align="center" ><a href="add_topic.php?pid=<?=$crow['forumid']?>" class="normlinks"><strong>Edit</strong></a></td>

in add page

simply write

<input name="title" type="text" class="box" id="title" size="45"  <? if (isset($_GET['pid'])){?>value="<?=$subcategory?>" <? }?>>

thats it simple

Thanks praveen
i qm having the category table in that table only i want to insert subcategory
i dont want to create seperate table for subcategory
i got with seperate table
but actually i am looking for the total categories and subcategories in a single table

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.