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 8239129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:02:33+00:00 2026-06-07T20:02:33+00:00

I’m new to PHP and after looking on the web for the last hour

  • 0

I’m new to PHP and after looking on the web for the last hour I couldn’t find out what was wrong with my code so I come to you. Im trying to have a place to update my data collected from a from. I get this error. Undefined index: id in /Users/mm1/Desktop/php/backend form/edit_ac.php on line 12. Here is what I have so far. Can someone please help..

<?php require("database.php"); ?>
<?php require("functions.php"); ?>

<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");


$id= mysql_prep($_GET['id']);
$last= mysql_prep($_POST['last']);
$first= mysql_prep($_POST['first']);


// update data in mysql database
$sql="UPDATE $tbl_name SET first='{$first}', last='{$last}' WHERE id='{$id}'";
$result=mysql_query($sql);

// if successfully updated.
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='edit_info.php'>View result</a>";
}
else {
echo "ERROR";
}
?>

Here is the form (I know it all isn’t complete I’m just trying to get it to work first.)

<?php require("database.php"); ?>


<?php // Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// get value of id that sent from address bar
$id=$_GET['id'];

// Retrieve data from database
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>


<form name="form1" method="post" action="edit_ac.php">
<table width="700" border="0" cellpadding="5">
<tr>
<td colspan="2" class="center"><h3>PARTICIPANT IDENTIFICATION</h3></td>
</tr>
  <tr>
  <td width="218">First</td>
    <td width="456"><input name="first" type="text" maxlength="50" id="first" value="<? echo $rows['first']; ?>" /></td>
  </tr>
   <tr>
  <td width="218">Last</td>
    <td width="456"><input name="last" type="text" maxlength="50" id="last" value="<? echo $rows['last']; ?>" /></td>
  </tr>
   <tr>
  <td width="218">Middles</td>
    <td width="456"><input name="middle" type="text" maxlength="50" id="middle" value="<? echo $rows['middle']; ?>"/></td>
  </tr>
  <tr>
  <td>Address</td>
    <td><input name="address" type="text" maxlength="50" id="address" value="<? echo $rows['address']; ?>"/></td>
  </tr>
  <tr>
  <td>City</td>
    <td><input name="city" type="text" maxlength="50" id="city" value="<? echo $rows['city']; ?>"/></td>
  </tr>
  <tr>
  <td>State</td>
    <td><input name="state" type="text" maxlength="15" id="state"  value="<? echo $rows['state']; ?>"/></td>
  </tr>
  <tr>
  <td>Zip</td>
    <td><input name="zip" type="text" maxlength="15" id="zip" value="<? echo $rows['zip']; ?>" /></td>
  </tr>
  <tr>
  <td>Home Phone</td>
    <td><input name="home_phone" type="text" id="home_phone" value="<? echo $rows['home_phone']; ?>" /></td>
  </tr>
  <tr>
  <td>Daytime Phone</td>
    <td><input name="daytime_phone" type="text" id="daytime_phone" value="<? echo $rows['daytime_phone']; ?>" /></td>
  </tr>
  <tr>
  <td>Email Address</td>
    <td><input name="email_address" type="text" id="email_address" value="<? echo $rows['email_address']; ?>" /></td>
  </tr>
  <tr>
  <td>Birthday</td>
    <td><input name="month" type="text" id="month" size="3" maxlength="2" value=""/> / <input name="day" type="text" id="day" size="3" maxlength="2" value=""/> / <input name="year" type="text" id="year" size="5" maxlength="4"  value=""/></td>
  </tr>
  <tr>
  <td>Social Security Number</td>
    <td><input name="ss_1" type="text" id="ss_1" size="5" maxlength="3" value=""/> - <input name="ss_2" type="text" id="ss_2" size="5" maxlength="2"  value=""/> - <input name="ss_3" type="text" id="ss_3" size="5" maxlength="4" value="" /></td>
  </tr>
  <tr>
    <td colspan="2" class="center"><h3>PHOTO IDENTIFICATION </h3></td>
    </tr>
  <tr> 
    <td>Type of ID</td>
    <td>
      <input type="text" name="type_of_id" id="type_of_id" value=""/></td>
  </tr>
    <tr>
    <td>ID Number</td>
    <td>
      <input type="text" name="id_number" id="id_number" value="" /></td>
  </tr>
    <tr>
    <td>Issuing Jurisdiction</td>
    <td><input type="text" name="issuing_state" id="issuing_state"  value=""/></td>
  </tr>
    <tr>
    <td>Expiration Date</td>
    <td><input type="text" name="expiration_date" id="expiration_date" value=""/></td>
  </tr>
     <tr>
    <td>Issue Date</td>
    <td><input type="text" name="issue_date" id="issue_date" value="" /></td>
  </tr>
   <tr>
    <td colspan="2" class="center"><h3>ESTABLISHING YOUR ACCOUNT</h3></td>
    </tr>
     <tr>
  <td colspan="2" class="center">Designate Account Type</td>
  </tr>
  <tr>
  <td>
  Acount Type
  </td>
  <td>
      <label>
        <input type="radio" name="traditional" value="1" id="traditional" />
        Traditional</label>
      <br />
      <label>
        <input type="radio" name="roth" value="1" id="roth" />
       Roth</label>
      <br />
      <label>
        <input type="radio" name="sep" value="1" id="sep" />
        SEP</label>
      <br />
        <label>
        <input type="radio" name="simple" value="1" id="simple" />
        SIMPLE</label>
      <br /></td>
  </tr>
  <tr>
  <td colspan="2" class="center">Fund Your Account</td>
  </tr>
   <tr>
  <td colspan="2"><input name="rollover" type="radio" value="1" id="rollover" />I will rollover cash from an existing IRA or qualified retirement plan
    </td>
  </tr>
   <tr>
  <td>Prior Custodian Plan Name</td>
  <td><input name="prior_plan_name" type="text" maxlength="50" id="prior_plan_name" value=""/></td>
  </tr>
   <tr>
  <td>Expected Rollover Amount</td>
  <td><input name="rollover_amount" type="text" maxlength="50" id="rollover_amount" value=""/></td>
  </tr>
   <tr>
  <td colspan="2"><input name="transfer" type="radio" value="1"  id="transfer" />    I will transfer assets from another IRA and have attached a TRANSFER AUTHORIZATION form </td>
  </tr>
   <tr>
  <td colspan="2"><input name="contribution" type="radio" value="1"  id="contribution"/>    I have attached a contribution check as follows</td>
  </tr>
   <tr>
  <td>IRA Cash Contribution for the Year</td>
  <td><input name="cash_contributions_1" type="text" id="cash_contributions_1" value=""/></td>
  </tr>
   <tr>
  <td>in the amount of</td>
  <td><input name="amount_1" type="text" id="amount_1" value=""/></td>
  </tr>
   <tr>
  <td>IRA Cash Contribution for the Year</td>
  <td><input name="cash_contributions_2" type="text" id="cash_contributions_2" value="" /></td>
  </tr>
   <tr>
  <td>in the amount of</td>
  <td><input name="amount_2" type="text" id="amount_2" value="" /></td>
  </tr>
   <tr>
  <td>Employer OR Employee (circle one) SEP/SIMPLE Contribution for the Year</td>
  <td><input name="employer_contributions" type="text" id="employer_contributions" value="" /></td>
  </tr>
    <tr>
  <td>in the amount of</td>
  <td><input name="amount_3" type="text" id="amount_3" value="" /></td>
  </tr>
   <tr>
   <td></td>
    <td style="text-align:right"><input type="submit" name="Submit" value="Submit"></td>
  </tr>
</table>
</form>

</table>
<?php
// close connection
mysql_close();
?>
  • 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-06-07T20:02:34+00:00Added an answer on June 7, 2026 at 8:02 pm

    Add the id into the form as a hidden field.

    <input type="hidden" name="id" value="<?php print $rows['id'] ?>">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.