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 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 table that stores user information. The table has a userid (identity)
I have a table that includes 27 DropDownLists for user input. My table has
Let's say I have a table that has user_id, date, score, and every user
I have a table that has account numbers in (account_num) and user profiles (profile_id).
I have a User table that has all of their avatars saved in an
Currently I have a User table that has a toys_owned column that is an
I have a user table 'users' that has fields like: id first_name last_name ...
I have already created a form authentication application. I had User table and created
I have 4 tables. Table A that has users - ( user_id, username, and
I have a a user that has a lot of tables against their account.

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.