Jump to content

Recommended Posts

Heres the problem. i need to be able to click edit and have it open the page and in each of the forms areas have the info from the database put in there . Well heres my code i have only the edit and main table portionon this one. So here it is (oh and i get no errors it just doesnt work).

if(!isset($_GET['mode'])){

// make sql query
if(isset($_GET['edit']) && $_GET['edit']>0){

	$query = sprintf("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productId = %s", $db->mySQLSafe($_GET['edit'])); 

} 
<?php
if(!isset($_GET['mode']) && !isset($_GET['edit']) ){

} elseif(($_GET["mode"]=="new") || ($_GET["edit"]>0)){  

if(isset($_GET["edit"]) && $_GET["edit"]>0){ $modeTxt = $lang['admin']['edit']; } else { $modeTxt = $lang['admin']['add']; } 
?>
<table border="0" cellspacing="0" cellpadding="3" class="mainTable">
  <tr>
    <td colspan="2" class="tdTitle"><?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } echo $lang['admin']['products']['product'];?> </td>
  </tr>
  <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_name2'];?></strong></td>
    <td>
      <input name="name" type="text" class="textbox" value="<?php if(isset($results[0]['name'])) echo validHTML($results[0]['name']); ?>" maxlength="255" />
    </td>
  </tr>

  <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_date'];?></strong></td>
    <td>
    <link rel='stylesheet' href='js/calander.css' type='text/css'>
    <link rel='stylesheet' href='admin/styles/style.css' type='text/css'>
    <script src='js/datepicker.js' language='javascript'></script>
    <SCRIPT LANGUAGE='JavaScript'>var date_field = new CalendarPopup('date_div'); date_field.showNavigationDropdowns(); document.write(str);</SCRIPT>
    <input id='releaseDate' name="releaseDate" type="text" class="textbox" value="<?php if(isset($results[0]['release_date'])) echo validHTML($results[0]['release_date']); ?>" maxlength="255" /> <img src='images/calendar.gif' onClick="date_field.select(document.getElementById('releaseDate'),'picker','yyyy-MM-dd'); return false;" title='select date' name='picker' id='picker'>
    </td>
    </tr>
    <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_type2'];?></strong></td>
    <td>
    <select name="Type" class="textbox" onChange="if(this.value=='Album'){document.getElementById('id_song').style.display='none';document.getElementById('id_album').style.display='';}else{document.getElementById('id_song').style.display='';document.getElementById('id_album').style.display='none';}">
    <option value='Song'<?php if($results[0]['type']=='Song') echo "selected";?>>Song</option>
    <option value='Album' <?php if($results[0]['type']=='Album') echo "selected";?>>Album</option>
    </select>
   </td>
    </tr>
<tr>
     <td width="25%" class="tdText"><strong>Album:</strong>
     </td>
     <td><input name="albumName" type="text" class="textbox" value="<?php if(isset($results[0]['albumName'])) echo $results[0]['albumName']; ?>" maxlength="255" /></td>
</tr>
<tr>
<td width="25%" class="tdText"><strong>Lottery Points (%):</strong>
</td>
<td><input name="lPoints" type="text" class="textbox" value="<?php if($results[0]['lPoints']!=0) echo $results[0]['lPoints']; else echo "0.05"; ?>" maxlength="255" /></td>
</tr>
  <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['prod_stock_no'];?></strong> <br />
<?php echo $lang['admin']['products']['auto_generated'];?>
</td>
    <td><input name="productCode" type="text" class="textbox" value="<?php if(isset($results[0]['productCode'])) echo $results[0]['productCode']; ?>" maxlength="255" /></td>
  </tr>
  <tr>
    <td colspan="2" class="tdRichText"><span class="tdText"><strong><?php echo $lang['admin']['products']['description'];?></strong> <?php echo $lang['admin']['products']['primary_lang'];?></span>
  </td>
    </tr>
  <tr>
    <td colspan="2" class="tdRichText">
<?php
	$oFCKeditor = new FCKeditor('FCKeditor');
	$oFCKeditor->BasePath = $GLOBALS['rootRel'].'admin/includes/rte/' ;

	if(isset($results[0]['description'])){ 
		$oFCKeditor->Value = $results[0]['description'];
	} else {
		$oFCKeditor->Value = "";
	}
	$oFCKeditor->Create();
?>
</td>
    </tr>

    <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['artist'];?></strong></td>
    <td>
<input name="artist" class="textbox" value="<?php echo $ccUserData[0]['customer_id']; ?>" type="hidden" />    
    </td>
    </tr>


    
  <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['category'];?></strong></td>
    <td>
<select name="cat_id" class="textbox">
<?php for ($i=0; $i<count($categoryArray); $i++){ ?>
<option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($results[0]['cat_id']) && $categoryArray[$i]['cat_id']==$results[0]['cat_id']) { echo "selected='selected'"; } ?>><?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?></option>
<?php } ?>
</select>
</td>
  </tr>
<tr>
<td class="tdText" align="left" valign="top" width="25%">
<strong>
Image:
</strong>
  <br>
<!--(Optional and thumbnails will automatically be made IF the format chosen is compatible.)-->
</td>
<td valign="top">
<div id="selectedImage">
</div>
<div id="imageControls">
<table border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
    <td>
<input name="imageName" style="width: 200px;" class="submit" type="file" id="image" />    </td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>

  
  <tr>
    <td width="25%" class="tdText"><strong><?php echo $lang['admin']['products']['normal_price2'];?></strong></td>
    <td><input name="price" value="<?php if(isset($results[0]['price'])) echo $results[0]['price']; ?>" type="text" class="textbox" size="10" /></td>
  </tr>

  <tr>
    <td class="tdText"><strong><?php echo $lang['admin']['products']['tax_class'];?></strong></td>
    <td class="tdText">
<select name="taxType">
    <?php
$taxTypes = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_taxes"); 
?>
<?php for($i=0; $i<count($taxTypes);$i++){ ?>
<option value="<?php echo $taxTypes[$i]['id']; ?>" <?php if(isset($results[0]['taxType']) && $taxTypes[$i]['id'] == $results[0]['taxType']) echo "selected='selected'"; ?>><?php echo $taxTypes[$i]['taxName']; ?> (<?php echo $taxTypes[$i]['percent']; ?>%)</option>
<?php } ?>
</select>
</td>
  </tr>
  <tr><td colspan=2>
  <div id='id_song' <?php if(trim($results[0]['type'])=='Album'){?>style="display:none"<?php }?>>
  <table>
  <tr>
       <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?></strong>
       </td>
       <td class="tdText">
       <input name="digital" type="hidden" value="1"/>
       <input name="digitalDir" type="file" id="digitalDir" value="" maxlength="255" />
       </td>
       </tr>
       <tr>
       <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?> Sample</strong>
       </td>
       <td class="tdText">
       <input name="digitalSample" type="file" id="digitalSample" value="" maxlength="255" />
       </td>
</tr>
  </table>
  </div>
  <div <?php if($results[0]['type']=='Song' || !isset($results[0]['type'])){?>style="display:none"<?php }?> id='id_album'>
  <table><tr><td>
  <?php $i=0;
  for($i=1;$i<=10;$i++){?>
  <table>
  	<tr><td colspan=2 class="tdText"><b><?php echo $i;?></b></td></tr>
  <tr>
  <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?></strong>
  </td>
  <td class="tdText">
  <input name="digital" type="hidden" value="1"/>
  <input name="digitalDir<?php echo $i;?>" type="file" id="digitalDir<?php echo $i;?>" value="" maxlength="255" />
  </td>
  </tr>
  <tr>
  <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?> Sample</strong>
  </td>
  <td class="tdText">
  <input name="digitalSample<?php echo $i;?>" type="file" id="digitalSample<?php echo $i;?>" value="" maxlength="255" />
  <input name="songtitle<?php echo $i;?>" type="text" id="songtitle<?php echo $i;?>" value="" maxlength="255" />
  </td>
  </tr>
  </table>

  <?php }?>
  </td><td>
  <?php for($i=11;$i<=20;$i++){?>
  <table>
  <tr><td colspan=2 class="tdText"><b><?php echo $i;?></b></td></tr>
  <tr>
  <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?></strong>
  </td>
  <td class="tdText">
  <input name="digital" type="hidden" value="1"/>
  <input name="digitalDir<?php echo $i;?>" type="file" id="digitalDir<?php echo $i;?>" value="" maxlength="255" />
  </td>
  </tr>
  <tr>
  <td class="tdText" valign="top"><strong><?php echo $lang['admin']['products']['product_type'];?> Sample</strong>
  </td>
  <td class="tdText">
  <input name="digitalSample<?php echo $i;?>" type="file" id="digitalSample<?php echo $i;?>" value="" maxlength="255" />
  <input name="songtitle<?php echo $i;?>" type="text" id="songtitle<?php echo $i;?>" value="" maxlength="255" />
  </td>
  </tr>
  </table>

  <?php }?>

  </td></tr></table>

Link to comment
https://forums.phpfreaks.com/topic/68721-solved-edit-info-question/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.