Jump to content


This topic is now archived and is closed to further replies.


Edit Submission

Recommended Posts

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:

  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)){


  $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'>&nbsp;&nbsp;$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:

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");



$wide_show = stripslashes($row['wide']);

$high_show = stripslashes($row['high']);








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>";



$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";


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.


Share this post

Link to post
Share on other sites
is your form tag look like
<form .. action="?id=$id&submit='OK'"

Share this post

Link to post
Share on other sites
" <form .. action="?id=$id&submit='OK'" "

?  could you include it all please?

Share this post

Link to post
Share on other sites


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.