| | |
adding subcategory
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
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
selcategory is the selection box which has category list
thats it foe adding for edit in manage page u will have a edit like
in add page
simply write thats it simple
for subcategory u first create table with prid,parentid name,title..etc
and then write query as
php Syntax (Toggle Plain Text)
$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
php Syntax (Toggle Plain Text)
<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>
php Syntax (Toggle Plain Text)
<td height="22" colspan="2" align="center" ><a href="add_topic.php?pid=<?=$crow['forumid']?>" class="normlinks"><strong>Edit</strong></a></td>
simply write
php Syntax (Toggle Plain Text)
<input name="title" type="text" class="box" id="title" size="45" <? if (isset($_GET['pid'])){?>value="<?=$subcategory?>" <? }?>>
Failure is success if we learn from it
![]() |
Similar Threads
- Storing a selected item into a global variable (JavaScript / DHTML / AJAX)
- HELP! need help adding text to slideshow (JavaScript / DHTML / AJAX)
- Texas Link Directory (Relevant Link Exchanges)
- memory (Motherboards, CPUs and RAM)
Other Threads in the PHP Forum
- Previous Thread: AOL block emails created from my server
- Next Thread: could i search images in a folder using php in offline
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue phpmyadmin problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






