| | |
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
Views: 451 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox chrelad class cms code 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 jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php phpmyadmin problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube






