Webocreation

Saturday, December 25, 2010

Form to show editable part and insert section in MVC of PHP(Part 2 of 5)




Untitled Document



<?php

$cmd = '';

if(isset($obj_))

{

$cmd = 'update';

$btnText = 'Save';

}

else

{

$cmd = 'insert';

$btnText = 'Add';

}

?>

<div class="heading">Add/Edit Categories</div>

<form method="post" onsubmit="return submitbutton('', 'f');" id="f" name="f" enctype="multipart/form-data" action="?menu=<?php echo $_REQUEST['menu']; ?>&p=<?php echo $_REQUEST['p']; ?>&p_sub=list&opt_view=<?php echo $cmd; ?>&edit_id=<?php echo $_GET['edit_id']; ?>">
<table width='50%' class='tblList' cellpadding='0' cellspacing='0'>

<tr class="tr_1">

<td style='padding-left:3px; width: 100px;'>Title </td>

<td>

<input type="text" required="1" id="title" title="Title" name="title" value="<?php echo $obj_['title']; ?>" class = "staff_dtl_text" />

</td>

</tr>

<tr class="tr_1">

<td style='padding-left:3px; width: 100px;'>Parent Category </td>

<td>

<select name="cat_id">

<option value="0">None</option>

<?php

foreach($cdata as $c)

{

?>

<option value="<?php echo $c['id']; ?>"><?php echo $c['title']; ?></option>

<?php

}

?>

</select> if you choose "None" that will be parent category

</td>

</tr>



<tr>

<td>&nbsp;</td>

<td>

<input type="submit" name='submit' value="<?php echo $btnText; ?>" class="submit" />

<input type="button" name='cancel' value="Cancel" onclick="document.location='<?php echo $_SERVER['HTTP_REFERER']; ?>';" class="submit" />

</td>

</tr>

</table>
</form>


No comments:

Post a Comment