Jump to content

Trying To Upload A New Link To Database But It Wont Work


pafruu
 Share

Recommended Posts

Hi all. Im currently trying to figure out where the site went wrong into not saving new links into the database. Here is the code from the form itself. What am I missing??<font class="t1">Edit Tools</font><p>{foreach from=$links item=link}<form action="" method="post" enctype="multipart/form-data">Title: <input type="text" name="title" value="{$link.title}"><br>Link: <input type="text" name="link" value="{$link.link}"><br><textarea name="description" cols="25" rows="6">{$link.description}</textarea><br>Image: {if ($link.image != "")}<a href="{$link.link}" target="links"><img src="images/links/{$link.image}"></a>{else}<input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input type="file" name="image">{/if}<br><input type="hidden" name="id" value="{$link.id}"><input type="hidden" name="savelink" value="1"><input type="submit"></form><p>{/foreach}<hr><b>New link:</b><p><form action="" method="post" enctype="multipart/form-data">Title: <input type="text" name="title"><br>Link: <input type="text" name="link"><br><textarea name="description" cols="25" rows="6"></textarea><br>Image: <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input type="file" name="image"><br><input type="hidden" name="savelink" value="1"><input type="submit"></form>

Link to comment
Share on other sites

not sure ifthis isit but here it goes:"<?if (!defined('HOMESELLERS')) { die ("You can't access this file directly...");}require_once('lang/'.$LANGUAGE.'_listing.php');if (isset($_GET["ftn"])) { $ftn = $_GET["ftn"];} elseif (isset($_POST["ftn"])) { $ftn = $_POST["ftn"];} else { $ftn = "";}if (isAdminLoggedIn()) { if (isset($_GET["listing_id"])) { $listing_id = $_GET["listing_id"]; } elseif (isset($_POST["listing_id"])) { $listing_id = $_POST["listing_id"]; } if (isset($_POST["savelisting"])) { // Save form information savelisting($listing_id); } if (isset($_POST["saveimages"])) { // Save form information saveimages($listing_id); } if (isset($_GET["deleteimage"])) { deleteimage($listing_id, $_GET["deleteimage"]); } switch($ftn) { case "addlisting": // Get form information $newids = createids(1); $smarty->assign('newids', $newids); $section_template = "admin_addlisting"; break; case "editlisting": // Get form information $listing_info = getlisting($listing_id); $smarty->assign('listing_info', $listing_info); $section_template = "admin_editlisting"; break; case "viewimages": // Get form information $listing_images = getimages($listing_id); $smarty->assign('listing_id', $listing_id); $smarty->assign('listing_images', $listing_images); $section_template = "admin_images"; break; case "removelisting": delete_listing($listing_id); $smarty->assign('_message', 'Listing '.$listing_id.' has been removed!'); break; case "marklistingassold": marksold($listing_id); $smarty->assign('_message', 'Listing '.$listing_id.' has been marked as sold!'); break; case "addids": $newids = createids($_POST["amountids"], $_POST["startid"]); $smarty->assign('newids', $newids); $section_template = "admin_addids"; break; case "edittools": if (isset($_POST['savelink'])) { if (isset($_POST['id'])) { $query = "UPDATE listings SET link = \"".addslashes($_POST['link'])."\", title = \"".addslashes($_POST['title'])."\", description = \"".addslashes($_POST['description'])."\" WHERE id = ".$_POST['id']; } else { $query = "INSERT INTO links (link, title, description) VALUES (\"".$_POST['link']."\", \"".$_POST['title']."\", description = \"".$_POST['description']."\") "; }//echo $query; } $query = "SELECT id, link, title, description, image FROM links"; $results = $db->GetArray($query); $smarty->assign('links', $results); $section_template = "admin_edittools"; break; default: break; }} else { $section_template = "admin_login";}?>"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...