Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:19:36+00:00 2026-05-13T06:19:36+00:00

UPDATE: I narrowed it down, when I got rid of this tag in the

  • 0

UPDATE: I narrowed it down, when I got rid of this tag in the header.php file it all works, can someone please explain this.

<script src="#" type="text/javascript"></script>

Hi I’m having quite an annoying issue with my php code. I am trying to update a php database, from a form, when I do this however the fields in the data base become empty after submitting. Please Help! You can view it in action here http://andcreate.com/shoelace/admin/edit1.php click on the lists on the right to edit them and see what happens.

<?php
include("header.php");

echo "<h2>Edit Posts</h2>";

echo "<div id='editNav'>";
echo "<p>Choose Post to Edit</p>";




//////////GET ALL RECORDS AND BUILD A NAV SYSTEM FROM THEM////////
$results = mysql_query("SELECT * FROM shoeData ");



while($row = mysql_fetch_array($results)){




 $id = $row['id'];
 $name = $row['name'];
 $about = $row['about'];

 echo "$date <a href=\"" . $_SERVER['PHP_SELF'] . "?id=$id" . "\">" . substr($name, 0, 40) . " </a> <br/> ";


 }

$thisID = $_GET['id'];

if(!isset($thisID)){
 $thisID = 22;

}




//////////FINISH ALL RECORDS AND BUILD A NAV SYSTEM FROM THEM////////

echo "</div>";



///////IF USER SUBMITS CHANGES UPDATE THE DATABASE//////////
//has user pressed the button
$update = $_GET['update'];

if($update == "yes") {

 $name = $_POST['name'];

 $about =  $_POST['about'];

 $company =  $_POST['company'];

 $buy =  $_POST['buy'];



 //update data for this record
 $sql = "UPDATE shoeData SET 
 name = \"$name\",
 about = \"$about\",
 company = \"$company\",
 buy = \"$buy\"
 WHERE id= $thisID";
 $thisUpdate = mysql_query($sql) or die(mysql_error());


}




///////END IF USER SUBMITS CHANGES UPDATE THE DATABASE//////////




/////////// HERE WE GET THE INFO FOR ONE RECORD ONLY//////// 
$results = mysql_query("SELECT * FROM shoeData WHERE id=$thisID");



while($row = mysql_fetch_array($results)){


 $name = $row['name'];

 $about = $row['about'];

 $company = $row['company'];

 $buy = $row['buy'];

}
//////////////FINISH GETTING INFO FOR ONE RECORD ONLY/////////////



?>

<form name="formS" method="post" action="<?php echo $_SERVER['PHP_SELF']."?id=$thisID&update=yes";?>">

Name
<p>
<input type="text" name="name" id="name" value="<?php echo $name;?>" />
</p>
About
<p>
<input type="text" name="about" id="about" value="<?php echo $about;?>" />
</p>
Company
<p>
<input type="text" name="company" id="company" value="<?php echo $company;?>" />
</p>
Name
<p>
<input type="text" name="buy" id="buy" value="<?php echo $buy;?>" />
</p>



<p>
<input type="submit" name="submit" id="submit"  />
</p>




</form>
<p><a class="delete" href="delete.php?id=<?php echo $thisID;?>">Delete this post</a></p>

<?php
include("footer.php");
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:19:37+00:00Added an answer on May 13, 2026 at 6:19 am

    You have $update = $_GET['update'];, but then right after that, you’re using $_POST. A given request is either GET or POST, not both – thus whenever $_GET['update'] is set to “yes”, there aren’t going to be any POST vars set, and thus the update will be done with all of the values it’s setting blank.

    Chances are you actually meant to use either $_GET or $_POST in both places – since your updates are going through, but are blank, it sounds like you want to use $_GET (though for form submission/updates, you should probably really be using POST instead).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: Hi, I've narrowed down the problem(s) and it appears to be in this
-- update -- Ok, I've narrowed this down to the keywords being checked, The
Update: I reported this as a bug to Apple and they fixed it! All
Based on some standard web searching, I have narrowed down my problem to this:
I have a simple textarea which works in all browsers i.e. I can click
I'm downloading files from a HTTPS website. I've narrowed the problem down to this:
Updated: Narrowed this down even further eliminating the aspx JavaScript reference. So it's down
Ive narrowed down to this method but i don't understand why its locking the
UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
Update : This is no longer an issue from C# 6, which has introduced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.