Lessur Posted August 11, 2006 Share Posted August 11, 2006 Ok, I have an flash submission system. You upload the flash file, along with some comments, a title, etc, it puts the information in a mySQL database, give it an id, and you can access it via view.php?id=(id here).I want to make an edit submission page, so I did the following, for editsub.php:[code]<?php if ($_SESSION['username']){ $sql=mysql_query("SELECT * FROM `portal` ORDER BY id DESC LIMIT 0 , 200 ") or die(mysql_error()); while ($row=mysql_fetch_array($sql)){ $i++; $id=$row['id']; //Id $title=stripslashes($row['title']); //Title $author=stripslashes($row['user']); //Username $small_image=stripslashes($row['small_image']); //Small icon to go with the submission if ($author == $username){ echo "<a href='editsub2.php?id=$id'><img src='small_images/$small_image' width='50' height='50' border='0'> $title by $author</a><br>"; } else{ echo ""; } } } else { echo "<div align='center'>You must be logged in to edit submissions!</div>"; }?>[/code]That, you access when you are logged in, generating a page with all of your submissions on it. Now, if you may have noticed, each links to editsub2.php?id=$id .This is editsub2.php:[code]<?php if (is_numeric($_GET['id'])){ if ($_SESSION['username']){ if ($_GET['submit']){$check=mysql_num_rows(mysql_query("SELECT * FROM `portal` WHERE id = '$id' LIMIT 1"));if ($check == 1){$sql=mysql_query("SELECT * FROM `portal` WHERE id = '$id' LIMIT 1");$row=mysql_fetch_array($sql);$title_show=stripslashes($row['title']);$wide_show = stripslashes($row['wide']);$high_show = stripslashes($row['high']);$title_show=stripslashes($row['title']);$author_show=stripslashes($row['user']);$desc_show=stripslashes($row['desc']);// USED TO UPDATE DATABASE$title=addslashes(strip_tags($_POST['title']));$desc=addslashes(strip_tags($_POST['desc']));$wide=addslashes(strip_tags($_POST['wide']));$high=addslashes(strip_tags($_POST['high']));$terms=addslashes(strip_tags($_POST['terms']));if ($title == ""){echo "Field title left blank <a href='?'>Go back?</a>";}elseif($desc == ""){echo "Field desccription left blank <a href='?'>Go back?</a>";}elseif ($wide == ""){echo "Field width left blank <a href='?'>Go back?</a>";}elseif ($high == ""){echo "Field height left blank <a href='?'>Go back?</a>";}elseif (!is_numeric($wide) || !is_numeric($high)){echo "Field width or height false <a href='?'>Go back?</a>";}elseif ($terms == ""){echo "You did not agree to are Terms of Use! <a href='?'>Go back?</a>";}else{$sql=mysql_query("UPDATE `portal` ( `title` , `desc` , `wide` , `high`) VALUES ('$title', '$desc', '$wide', '$high')");if ($sql){echo "Success! Submission updated!! - <a href='index.php'>Index!</a>";}else {echo "Failed";}[/code]I have a form on the page also, with:[code]<input name="title" type="text" id="title" value="<?php echo "$title_show"; ?>" size="20" maxlength="15">[/code]For example. So to my understanding, this should work. On editsub2.php it should show the $title_show in the database as the value for the textboxes, and should update the submission. but this does not work. It does not give the values to the textboxes, and when i click the submit button, it clicks and nothing happens.Help? Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/ Share on other sites More sharing options...
Lessur Posted August 11, 2006 Author Share Posted August 11, 2006 bump Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/#findComment-73034 Share on other sites More sharing options...
sasa Posted August 11, 2006 Share Posted August 11, 2006 is your form tag look like<form .. action="?id=$id&submit='OK'" Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/#findComment-73080 Share on other sites More sharing options...
Lessur Posted August 11, 2006 Author Share Posted August 11, 2006 " <form .. action="?id=$id&submit='OK'" "? could you include it all please? Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/#findComment-73182 Share on other sites More sharing options...
Lessur Posted August 12, 2006 Author Share Posted August 12, 2006 bump Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/#findComment-73678 Share on other sites More sharing options...
Lessur Posted August 12, 2006 Author Share Posted August 12, 2006 bump Quote Link to comment https://forums.phpfreaks.com/topic/17197-edit-submission/#findComment-73860 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.