Jump to content

topianno

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

topianno's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey Guys, I am still having trouble getting this to work. I believe I have my categories setup properly for the array - I think? Below is a screen shot of my PHP MY ADMIN Panel with my category structure. Also, I have included the code for my entire form. This form is used not only to submit new testimonials from patients but also to update them when need be. <? require($_SERVER['DOCUMENT_ROOT'] . "/inc/adminFunctions.php"); require($_SERVER['DOCUMENT_ROOT'] . "/inc/categories.class.php"); require($_SERVER['DOCUMENT_ROOT'] . "/inc/content.class.php"); require($_SERVER['DOCUMENT_ROOT'] . "/inc/FCKeditor/fckeditor.php"); checkAccess("Testimonials"); $NewsParrentCategoryID = 2; $Categories = new Categories; $Categories = $Categories -> getChildern($NewsParrentCategoryID); $Media = new Content; $error[]=""; if ($_POST['action'] == "Delete") $Media -> deleteArchive($_POST['Details']['ContentID'], "/sa/testimonials/"); if ($_POST['action'] == "Submit") $error = $Media -> addUpdate($_POST['Details'], "/sa/testimonials/"); $Details = $_POST['Details']; if ($_GET['action'] == "DeleteFile") unlink ($_SERVER['DOCUMENT_ROOT'] .$_GET['FileID']); if ($_GET['ContentID'] != "" ) $Details = $Media -> getDetails($_GET['ContentID']); if ($Details['cReleaseDate'] == "" ) $Details['cReleaseDate'] = date('m/d/Y'); $imageFile = "/images/media/".$Details['ContentID'].".jpg"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <titleTestimonials Editor</title> <link rel="STYLESHEET" type="text/css" href="/style.css"> <link rel="STYLESHEET" type="text/css" href="/sa/admin.css"> </head> <body> <? include($_SERVER['DOCUMENT_ROOT'] . "/sa/header.php")?> <? $links = array( "Browse" =>"index.php"); $title = ($Details['ContentID'] == "")? "Add Testimonial": "Update '". $Details['cName']."'"; printHeader($title, $links); ?> <br> <FORM METHOD="post" ACTION="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="100%"> <tr> <td valign="top" width="470"> <strong>Testimonial Details</strong> <input type="Hidden" name="Details[cCategoryID]" value="<?=$NewsParrentCategoryID?>"> <input type="Hidden" name="Details[cReleaseDate]" value="01/01/2007"> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" width="480"> <TR> <TD CLASS="tableheadder" colspan="4"></TD> </TR> <TR> <TD COLSPAN="2" <? if (in_array("cName", $error)) echo "class=\"error\"";?>>Name<BR><INPUT TYPE="TEXT" NAME="Details[cName]" SIZE="50" style="width:510px;" MAXLENGTH="255" VALUE="<?=$Details['cName']?>"></TD> </TR> <TR> <td>Weight/Sizes/Inches Lost <BR><INPUT TYPE="TEXT" NAME="Details[cSubTitle]" SIZE="50" style="width:250px;" MAXLENGTH="255" VALUE="<?=$Details[cSubTitle]?>"></TD> <td valign="top">Image <? if ( file_exists($_SERVER['DOCUMENT_ROOT'].$imageFile)) echo "<a href=\"$imageFile\" target=\"_blank\" CLASS=\"std\">preview current</a>";?><BR><input NAME="image" TYPE="file" style="width:250px;"></td> </TR> <TR> <td>Category<BR> <div class="form"> <select name="Details[cCategoryID]" size="9" multiple="multiple" style="width:250px;"> <? foreach ($Categories[$NewsParrentCategoryID ] as $CategoryID => $CatDetails){ echo "<option value=\"$CategoryID\""; if ($CategoryID == $Details[cCategoryID]) echo " SELECTED"; echo "> ".$CatDetails["cName"]."</option>\n" ; } ?> </select> </TD> <td valign="top"> </td> </TR> <tr valign="top"> <td colspan="2">Quote<BR><INPUT TYPE="TEXT" NAME="Details[cImageCaption]" SIZE="50" style="width:510px;" MAXLENGTH="255" VALUE="<?=$Details[cImageCaption]?>"></TD> </tr> <TR> <TD COLSPAN="2" <? if (in_array("cBody", $error)) echo "class=\"error\"";?>>Testimonial<BR> <? $FCKeditor = new FCKeditor('Details[cBody]', 510, 300, false) ; $FCKeditor->Value = $Details['cBody'] ; $FCKeditor->Create() ;?> </td> <INPUT TYPE="Hidden" NAME="Details[ContentID]" VALUE="<?=$Details['ContentID']?>"> </tr> <TR> <TD align="right" colspan="2"><INPUT TYPE="submit" NAME="action" VALUE="Submit"> <INPUT TYPE="submit" NAME="action" VALUE="Delete" onclick="javascript: return confirm('Are you sure you want to DELETE this Testimonial ?');"></td> </TR> </TABLE> </FORM> <? include($_SERVER['DOCUMENT_ROOT'] . "/sa/footer.php")?> Any help would be greatly appreciated! Thanks! [attachment deleted by admin]
  2. Hey Joel, I don't understand. I am new to one to many relationships in PHP. This is my current database structure: CategoryID cParentID cName cOrder cDesc cImageCaption cUserLastMod cDateLastMod There are a total of 10 categories. Currently only one testimonials is able to be posted to one category. I want the system to be able to post to multiple categories. I've gotten everything to work, but I believe my problem lies with my form code. The form will allow me to select multiple categories. However, the system will not save the information once its been posted. It reverts back to assigning the testimonials to only one category. Here is the code I am referring to in my form below: <? foreach ($Categories[$NewsParrentCategoryID ] as $CategoryID => $CatDetails){ echo "<option value=\"$CategoryID\""; if ($CategoryID == $Details[cCategoryID]) echo " SELECTED"; echo "> ".$CatDetails["cName"]."</option>\n" ; } ?>
  3. I have a small CMS for Patient Testimonials. I am trying to modify the system so as to assign multiple patient testimonials to multiple categories in the database. For example: A patient may fall under /women But they may fall under other categories as well. For Example: /century member /platinum member /gold Member I have a PHP forum I am using to add and edit listings. However, whenever I select more than one category in the list, the database only saves one. I want to modify the system so that multiple categories may be selected. I have listed a copy of my PHP form below: Any help would be greatly appreciated! Best, -Gabe <FORM METHOD="post" ACTION="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="100%"> <tr> <td valign="top" width="470"> <strong>Testimonials Details</strong> <input type="Hidden" name="Details[cCategoryID]" value="<?=$NewsParrentCategoryID?>"> <input type="Hidden" name="Details[cReleaseDate]" value="01/01/2007"> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" width="480"> <TR> <TD CLASS="tableheadder" colspan="4"></TD> </TR> <TR> <TD COLSPAN="2" <? if (in_array("cName", $error)) echo "class=\"error\"";?>>Name<BR><INPUT TYPE="TEXT" NAME="Details[cName]" SIZE="50" style="width:510px;" MAXLENGTH="255" VALUE="<?=$Details['cName']?>"></TD> </TR> <TR> <td>Weight/Sizes/Inches Lost <BR><INPUT TYPE="TEXT" NAME="Details[cSubTitle]" SIZE="50" style="width:250px;" MAXLENGTH="255" VALUE="<?=$Details[cSubTitle]?>"></TD> <td valign="top">Image <? if ( file_exists($_SERVER['DOCUMENT_ROOT'].$imageFile)) echo "<a href=\"$imageFile\" target=\"_blank\" CLASS=\"std\">preview current</a>";?><BR><input NAME="image" TYPE="file" style="width:250px;"></td> </TR> <TR> <td>Category<BR> <div class="form"> <select name="Details[cCategoryID]" size="9" multiple="multiple" style="width:250px;"> <? foreach ($Categories[$NewsParrentCategoryID ] as $CategoryID => $CatDetails){ echo "<option value=\"$CategoryID\""; if ($CategoryID == $Details[cCategoryID]) echo " SELECTED"; echo "> ".$CatDetails["cName"]."</option>\n" ; } ?> </select> </TD> <td valign="top"> </td> </TR> <tr valign="top"> <td colspan="2">Quote<BR><INPUT TYPE="TEXT" NAME="Details[cImageCaption]" SIZE="50" style="width:510px;" MAXLENGTH="255" VALUE="<?=$Details[cImageCaption]?>"></TD> </tr> <TR> <TD COLSPAN="2" <? if (in_array("cBody", $error)) echo "class=\"error\"";?>>Testimonial<BR> <? $FCKeditor = new FCKeditor('Details[cBody]', 510, 300, false) ; $FCKeditor->Value = $Details['cBody'] ; $FCKeditor->Create() ;?> </td> <INPUT TYPE="Hidden" NAME="Details[ContentID]" VALUE="<?=$Details['ContentID']?>"> </tr> <TR> <TD align="right" colspan="2"><INPUT TYPE="submit" NAME="action" VALUE="Submit"> <INPUT TYPE="submit" NAME="action" VALUE="Delete" onclick="javascript: return confirm('Are you sure you want to DELETE this Testimonial ?');"></td> </TR> </TABLE> </FORM>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.