| | |
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 |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parameter parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms soap source space speed sql static structure syntax system table tutorial up-to-date update upload url validation validator variable video web wordpress xml youtube






