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

  • Home
  • SEARCH
  • 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 6017773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:10:39+00:00 2026-05-23T03:10:39+00:00

I have a table that has the user ID already in it, but some

  • 0

I have a table that has the user ID already in it, but some of the information is missing and that is where I need the user to input it themselves. With the URL of the form I have their ID in it… winnerpage.php?ID=123

I am having troubles getting the code to work. Any help would be great!

This is the code on that winnerpage.php

<form enctype="multipart/form-data" action="winnerpage.php" method="POST">
ID: <input name="ID" type="text" value="<?=$ID?>" /><br/>
First Name: <input type="text" name="FN"><br />
Last Name: <input type="text" name="LN"><br />
Email: <input type="text" name="EM"><br />
Phone: <input type="text" name="PH"><br />
<input type="submit" name="edit" value="edit"></form> <br>

<?
require_once('mysql_serv_inc.php');

$conn = mysql_connect("$mysql_server","$mysql_user","$mysql_pass"); 
if (!$conn) die ("ERROR"); 
mysql_select_db($mysql_database,$conn) or die ("ERROR"); 

if(isset($_POST['edit']))
{
$sID        =    addslashes($_POST['ID']);
$sFN        =    addslashes($_POST['FN']);
$sLN        =    addslashes($_POST['LN']);
$sEM        =    addslashes($_POST['EM']);
$sPH        =    addslashes($_POST['PH']);


mysql_query('UPDATE winner SET FN=$sFN, LN=$sLN, EM=$sEM, PH=$sPH 
             WHERE ID=$sID') or die (mysql_error());

echo 'Updated!';
}

$query = "select * from winner order by ID";
$result = mysql_query($query);
?>

<?
   while ($link=mysql_fetch_array($result))
   {
     echo 'Unique ID - Completion Time - First Name - Last Name - Email - Phone<br/>'.$link[ID].' -' .$link[FN].' - '.$link[LN].' - '.$link[EM].' - '.$link[PH].'<br>';
     }
?>
  • 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-23T03:10:39+00:00Added an answer on May 23, 2026 at 3:10 am

    1)
    ID: <input name="ID" type="text" value="<?=$ID?>" /><br/>

    Where do you get that $ID?
    Are you doing something like $_GET['ID'] or are you relying on safe_mode being ON? (it’s not clear from the code you provided)
    (better yet, if(isset($_GET['ID'])) { $ID = (int)$_GET['ID'] }

    2) Please don’t to that. Don’t use addslashes(). Use mysql_real_escape_string() or, even better, prepared statements. Addslashes is not utterly reliable in escaping datas for queries.

    sID    =    (int)$_POST['ID'];
    $sFN   =    mysql_real_escape_string($_POST['FN']);
    $sLN   =    mysql_real_escape_string($_POST['LN']);
    $sEM   =    mysql_real_escape_string($_POST['EM']);
    $sPH   =    mysql_real_escape_string($_POST['PH']);
    

    Also, add 'value=""' to each input field (not mandatory)

    3) encapsulate values in query:

    mysql_query("UPDATE winner SET FN='".$sFN."', LN='".$sLN."', EM='".$sEM."', PH='".$sPH."' WHERE ID='".$sID."'") or die (mysql_error());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user table in my mysql database that has a password column.
I have a table that has redundant data and I'm trying to identify all
I have a table that has an insert trigger on it. If I insert
I have a table that has a processed_timestamp column -- if a record has
I have a table that has a primary key that's an INT... I have
I have a table that has 8 million records, with many fields, including lat/long
I have a table that has about 1/2 million records in it. Each month
I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT
Suppose I have a database table that has a timedate column of the last
I have a table in MySQL that has 3 fields and I want to

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.