| | |
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 |
.htaccess ajax alerts apache api array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue error explodefunction file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect regex remote script search securephp server sessions shot sms soap source space sql subscription syntax system table tutorial update upload url validation validator variable video web xml youtube






