Bopo Posted April 24, 2009 Share Posted April 24, 2009 Hi This has had me pulling my hair out, I can't see any problems, I tried testing by echoing out my variables and the result is always blank, I have a very similar piece of code on another page and this is almost identical apart from form elements and table names. The problem is that nothing is being stored in $fname $lname and $title, I have tried many different approaches but the outcome is always the same, blank. <?php $idvalue = $_GET['id']; if(isset($_POST['save'])) { if(empty($_POST['fname']) && empty($_POST['lname']) && empty($_POST['title']) && empty($_POST['FCKeditor1'])) { die('Please fill in all required fields'); } $fname = ($_POST['fname']); $lname = ($_POST['lname']); $title = ($_POST['title']); $post = ($_POST['FCKeditor1']); echo $fname; echo $lname; echo $title; exit(); include("blogconnect.php"); $sql = "UPDATE blogposts SET firstname = '$fname', lastname = '$lname', title = '$title', post = '$post' WHERE id = '$idvalue'"; if(!mysql_query($sql, $connect)) { die('Error' . mysql_error()); } echo '<p>Record sucesfully updated, <a href="http://www.koicarpadvice.com/admin/posts.php">Return to posts</a></p>'; mysql_close($connect); } ?> <?php $idvalue = $_GET['id']; include("blogconnect.php"); $sql = "SELECT * FROM blogposts WHERE id = '$idvalue'"; $query = mysql_query($sql, $connect); while ($row = mysql_fetch_assoc($query)) { echo '<form id="form1" name="form1" method="post" action="" class="form"> <label for="author">First Name:</label> <input name="author" type="text" class="inputbox" id="fname" value="' . $row['firstname'] . '" /><br /><br /> <label for="author">Last Name:</label> <input name="author" type="text" class="inputbox" id="lname" value="' . $row['lastname'] . '" /><br /><br /> <label for="author">Title:</label> <input name="author" type="text" class="inputbox" name="title" id="title" value="' . $row['title'] . '" /><br /><br />'; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = $row['post']; $oFCKeditor->Create() ; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/155524-solved-information-not-being-stored/ Share on other sites More sharing options...
JonnoTheDev Posted April 24, 2009 Share Posted April 24, 2009 Its because all your input fields have the name author <input name="author" Use the correct names to match up to your $_POST array keys Quote Link to comment https://forums.phpfreaks.com/topic/155524-solved-information-not-being-stored/#findComment-818403 Share on other sites More sharing options...
jonsjava Posted April 24, 2009 Share Posted April 24, 2009 <?php $idvalue = $_GET['id']; include("blogconnect.php"); $sql = "SELECT * FROM blogposts WHERE id = '$idvalue'"; $query = mysql_query($sql, $connect); while ($row = mysql_fetch_assoc($query)) { echo '<form id="form1" name="form1" method="post" action="" class="form"> <label for="author">First Name:</label> <input name="fname" type="text" class="inputbox" id="fname" value="' . $row['firstname'] . '" /><br /><br /> <label for="author">Last Name:</label> <input name="lname" type="text" class="inputbox" id="lname" value="' . $row['lastname'] . '" /><br /><br /> <label for="author">Title:</label> <input name="title" type="text" class="inputbox" name="title" id="title" value="' . $row['title'] . '" /><br /><br />'; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = $row['post']; $oFCKeditor->Create() ; } } ?> you weren't setting the input NAMES. just the id's Quote Link to comment https://forums.phpfreaks.com/topic/155524-solved-information-not-being-stored/#findComment-818409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.