merlieon Posted September 6, 2013 Share Posted September 6, 2013 Hello i am trying to make an admin-panel and right now im stuck at the part where you should edit the content/topic at the home page so everything exept the submit button work please help! here's the code <?php include 'core/init.php'; protect_page(); admin_protect(); include 'includes/overall/overall_header.php'; ?> <title> Quadrox - AdminPanel </title> <article> <?php include 'includes/adminaside.php'?> <section> <h3>Admin - Panel</h3> <?php $hid = $_GET['hid']; $sql = "SELECT * FROM Home WHERE id = '".$hid."'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); ?> <form method="post" action="ednew.php"> <input type="hidden" name="id" value="<?php echo "$row[id]"?>"> <table cellpadding="8"> <tr> <td>Home-topic:</td> <td> <input type="text" name="Home_topic" size="50" value="<?php echo "$row[Home_topic]"?>"> </td> </tr> <tr> <td>Home-content:</td> <td> <textarea name="Home_content" rows="7" cols="60"><?php echo "$row[Home_content]"?> </textarea> </td> </tr> <tr> <td></td> <td> <input type="submit" value="Update Home Page" name="Home_update"> </td> </tr> </table> </form> <?php $Home_topic = $_POST['Home_topic']; $Home_content = $_POST['Home_content']; if (isset($_POST['Home_update'])){ $sql = "UPDATE Home SET Home_topic='$Home_topic', Home_content='$Home_content' WHERE id='$hid'"; mysql_query($sql); echo "Success"; } ?> </section> </article> <?php include 'includes/overall/overall_footer.php'?> Quote Link to comment Share on other sites More sharing options...
Barand Posted September 6, 2013 Share Posted September 6, 2013 Looks like you need to get $hid from $_POST['id'] when you process the form Quote Link to comment 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.