Jump to content

Cannot insert data into a database.. plz help


newguy2010

Recommended Posts

Everything on this page works the form loads and i can insert info into the form but when i click submit it just reloads the page(action="this page") and nothing happens.

  thanks in advance

  -Adam

<?php
require("connection/connection.php");
include("connection/functions.php");
?>
<HTML>
    <head>
        <meta content="yes" name="apple-mobile-web-app-capable" />
        <meta content="index,follow" name="robots" />
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <link href="" rel="apple-touch-icon" />
        <meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
        <meta name="format-detection" content="telephone=no"/>
        <link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
        <script src="javascript/functions.js" type="text/javascript"></script>
        <title>.: Bookmarks :.</title>
        <link href="" rel="apple-touch-startup-image" />
        
        
        <meta content="apple-mobile-web-app-status-bar-style" content="default" />
    </head>
    <body class="musiclist">
        <div id="topbar">
           <div id="title">.: Bookmarks :.</div>
            <div id="leftbutton">
                <a href="default.html"><img src="images/home.png"></a>
            </div>
            <div id="rightbutton">
                <a href="">Programs</a>
            </div>
        </div>
        <div id="tributton">
        	<div class="links">
        		<a id="pressed" href="Bookmarks/Bookmarks.php">Bookmarks</a><a  href="Music/Music.html">Music</a><a  href="">Movies</a>
            </div>
        </div>
        <div id="content" style="top: 36px">
        	<form method="post" action="AddBookmark.php">
                <span class="graytitle">Add Bookmark</span>
                <ul class="pageitem">
                    <li class="bigfield"><input type="text" name="BookmarkName" placeholder="Bookmark Name" /></li>
                    <li class="bigfield"><input type="text" name="BookmarkLink" placeholder="Bookmark Link" /></li>
                    <li class="select"><select name="d">
                        <?php 
                            $getbookmarksections = mysql_query("SELECT * FROM bookmarksections");
                            confirm_query($getbookmarksections);
                            
                            while($getbm = mysql_fetch_array($getbookmarksections)){
							$id = $getbm["ID"];
							$sn = $getbm["SectionName"];
                            	echo "<option value=\"$id\">$sn</option>";
                            }
                        ?>
                    </select><span class="arrow"></span></li>
                    <li class="button">
                    <input name="AddBookmark" type="submit" value="Add Bookmark" />
                    </li>
                </ul>
           	</form>
            <?php
			if(isset($_POST["AddBookmark"])){
				$SectionID = $id;
				$Bookmark = $_POST["BookmarkName"];
				$BookmarkLink = $_POST["BookmarkLink"];

				$add = "INSERT INTO `bookmarks` (`ID` ,`SectionID` ,`Bookmark` ,`BookmarkLink`)
								VALUES ('NULL', '$SectionID', '$Bookmark', '$BookmarkLink')"; 
				  if(confirm_query($add)){
				  echo "<span class=\"graytitle\">Bookmark '$BookmarkName' in '$sn' Added.</span>";
				  }
			}
                ?>
        </div>
        <div id="footer">
        </div>
    </body>
</HTML>
<?php 
//Close Connection
if(isset($connection)){
	mysql_close($connection);
}
?>

 

this is the code i suspect is not working

<?php
	if(isset($_POST["AddBookmark"])){
	        $SectionID = $id;
	        $Bookmark = $_POST["BookmarkName"];
		$BookmarkLink = $_POST["BookmarkLink"];

		$add = "INSERT INTO `bookmarks` (`ID` ,`SectionID` ,`Bookmark` ,`BookmarkLink`)
						VALUES ('NULL', '$SectionID', '$Bookmark', '$BookmarkLink')"; 
		if(confirm_query($add)){
		      echo "<span class=\"graytitle\">Bookmark '$BookmarkName' in '$sn' Added.</span>";
	        }
	}
?>

 

Link to comment
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.