| | |
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 |
# 5.2.10 action address apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display dissertation domain dynamic echo echo$_get[x]changingitintovariable... email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image images include insert ip javascript joomla legislation limit link load login mail masterthesis menu mlm multiple mysql mysqlquery oop open paypal pdf persist php popup problem query radio random record recursion remote script search server sessions sms sockets source space sql syntax system table tutorial update upload url validator variable video web youtube






