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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:45:48+00:00 2026-05-13T18:45:48+00:00

I have these codes, used to update mysql database AIS.php-used to input pnum and

  • 0

I have these codes, used to update mysql database

AIS.php-used to input pnum and then new.php will show the corresponding record for the pnum

<style>
input { font-size: 16px;}
</style>
<?php include('header.php'); ?>
<div id="main_content">


</div>
<?php include('footer.php'); ?>






<table width="900" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>


<form name="form1" method="post" action="new.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="16" style="background:#9ACD32; color:white; border:white 1px solid; text-align: center"><strong><font size="3">UPDATE IN-PATIENT</strong></td>
</tr>
<tr>

<td width="54"><font size="3">Patient #</td>
<td width="3">:</td>
<td width="168"><input name="pnum" type="text" id="pnum" maxlength="4"></td>
</tr>

<td width="54"><font size="3">Hospital #</td>
<td width="3">:</td>
<td width="168"><input name="hnum" type="text" id="hospnum" maxlength="4"></td>

<td width="41"><font size="3">Room #</td>
<td width="3">:</td>
<td width="168"><input name="rnum" type="text" id="rnum" maxlength="4"></td>

<td width="67"><font size="3">Date</td>
<td width="3">:</td>
<td width="168"><input name="adate" type="text" id="adate" maxlength="15">

<td width="67"><font size="3">Time</td>
<td width="3">:</td>
<td width="168"><input name="adtime" type="text" id="adtime" maxlength="15">

</td>




</tr>


<tr>
<td><font size="3">Last Name</td>
<td>:</td>
<td><input name="lname" type="text" id="lname" maxlength="15"></td>
<td><font size="3">First Name</td>
<td>:</td>
<td><input name="fname" type="text" id="fname" maxlength="15"></td>
<td><font size="3">Middle Name</td>
<td>:</td>
<td><input name="mname" type="text" id="mname" maxlength="15"></td>
</tr>


<tr>
<td><font size="3">Civil Status</td>
<td>:</td>
<td><input name="cs" type="text" id="cs" maxlength="7"></td>
<td><font size="3">Age</td>
<td>:</td>
<td><input name="age" type="text" id="age" maxlength="3"></td>
<td><font size="3">Birthday</td>
<td>:</td>
<td><input name="bday" type="text" id="bday" maxlength="11"></td>

</tr>

<tr>
<td><font size="3">Address</td>
<td>:</td>
<td><input name="ad" type="text" id="ad" maxlength="25"></td>
<td><font size="3">Telephone #</td>
<td>:</td>
<td><input name="telnum" type="text" id="telnum" maxlength="11"></td>

<td width="23"><font size="3">Sex</td>
<td width="3">:</td>
<td width="174"><input name="sex" type="text" id="sex" maxlength="1"></td>
</tr>

<tr>
<td><font size="3">Pls. Check</td>
<td>:</td>
<input type='hidden' name="stats1" value="0">
<td><input name="stats1" type="checkbox" id="SSS" value="SSS">SSS</td>
<td><font size="3"></td>
<td>:</td>
<input type='hidden' name="stats2" value="0">
<td><input name="stats2" type="checkbox" id="nonmed" value="NonMedicare">Non Medicare</td>

<td><font size="3"></td>
<td>:</td>
<input type='hidden' name="stats3" value="0">
<td><input name="stats3" type="checkbox" id="sh" value="stockholder">Stockholder</td>
</tr>


<tr>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats4" value="0">
<td><input name="stats4" type="checkbox" id="gsis" value="GSIS">GSIS</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats5" value="0">
<td><input name="stats5" type="checkbox" id="senior" value="seniorcitizen">Senior-Citizen</td>


<tr>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats6" value="0">
<td><input name="stats6" type="checkbox" id="dep" value="dependent">Dependent</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats7" value="0">
<td><input name="stats7" type="checkbox" id="emp" value="employee">Employee</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats8" value="0">
<td><input name="stats8" type="text" id="" value="" maxlength="15">Others</td>

</tr>

<tr>
<td><font size="3">Admitting/Attending Nurse</td>
<td>:</td>
<td><input name="nurse" type="text" id="nurse" maxlength="15"></td>

</tr>






<tr>

<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Search"></td>

</form>



</tr>
</table>
</td>
</form>
</tr>
</table>
<table>
<tr><td>

</tr>
</table>

</html>

new.php

<html>
<head>
<style>
input { font-size: 16px;}
</style>
<?php include('header.php'); ?>
<div id="main_content">

</div>
<?php include('footer.php'); ?>
<?php

  $con = mysql_connect("localhost","","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("Hospital", $con);
  $result = mysql_query("SELECT * FROM t2 WHERE PNUM='{$_POST["pnum"]}'");
?>

<table width="900" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="16" style="background:#9ACD32; color:white; border:white 1px solid; text-align: center"><strong><font size="3">UPDATE IN-PATIENT INFORMATION SHEET</strong></td>
</tr>
<tr>

<?php while ( $row = mysql_fetch_array($result) ) { ?>
<form name="form1" method="post" action="update.php">
<input type='hidden' name="pnum" value="">
<td width="54"><font size="3">Hospital #</td>
<td width="3">:</td>
<td width="168"><input name="hnum" type="text"  maxlength="4" value="<?php echo $row["HOSPNUM"]; ?> ">
</td>

<td width="41"><font size="3">Room #</td>
<td width="3">:</td>
<td width="168"><input name="rnum" type="text"  maxlength="4" value="<?php echo $row["ROOMNUM"]; ?>">
</td>

<td width="67"><font size="3">Admission Date</td>
<td width="3">:</td>
<td width="168"><input name="adate" type="text"  maxlength="15" value="<?php echo $row["ADATE"]; ?>">
</td>

<td width="67"><font size="3">Admission Time</td>
<td width="3">:</td>
<td width="168"><input name="adtime" type="text" maxlength="15" value="<?php echo $row["ADTIME"]; ?>">
</td>
</tr>

<tr>
<td><font size="3">Last Name</td>
<td>:</td>
<td><input name="lname" type="text" maxlength="15" value="<?php echo $row["LASTNAME"]; ?>"></td>
<td><font size="3">First Name</td>
<td>:</td>
<td><input name="fname" type="text" maxlength="15" value="<?php echo $row["FIRSTNAME"]; ?>"></td>
<td><font size="3">Middle Name</td>
<td>:</td>
<td><input name="mname" type="text" maxlength="15" value="<?php echo $row["MIDNAME"]; ?>"></td>
</tr>

<tr>
<td><font size="3">Civil Status</td>
<td>:</td>
<td><input name="cs" type="text" maxlength="7" value="<?php echo $row["CSTAT"]; ?>"></td>
<td><font size="3">Age</td>
<td>:</td>
<td><input name="age" type="text" maxlength="3" value="<?php echo $row["AGE"]; ?>"></td>
<td><font size="3">Birthday</td>
<td>:</td>
<td><input name="bday" type="text"  maxlength="7"value="<?php echo $row["BDAY"]; ?>"></td>

</tr>

<tr>
<td><font size="3">Address</td>
<td>:</td>
<td><input name="ad" type="text"  maxlength="25" value="<?php echo $row["ADDRESS"]; ?>"></td>
<td><font size="3">Telephone #</td>
<td>:</td>
<td><input name="telnum" type="text" maxlength="11" value="<?php echo $row["TELNUM"]; ?>"></td>

<td width="23"><font size="3">Sex</td>
<td width="3">:</td>
<td width="174"><input name="sex" type="text" maxlength="1" value="<?php echo $row["SEX"]; ?>"></td>
</tr>

<tr>
<td><font size="3">Pls. Check</td>
<td>:</td>
<input type='hidden' name="stats1" value="0">
<td><input name="stats1" type="checkbox" id="SSS"  maxlength="3" value="SSS">SSS</td>
<td><font size="3"></td>
<td>:</td>
<input type='hidden' name="stats2" value="0">
<td><input name="stats2" type="checkbox" id="nonmed" maxlength="9" value="Non Med">Non Medicare</td>

<td><font size="3"></td>
<td>:</td>
<input type='hidden' name="stats3" value="0">
<td><input name="stats3" type="checkbox" id="sh" value="stockholder">Stockholder</td>
</tr>

<tr>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats4" value="0">
<td><input name="stats4" type="checkbox" id="gsis" value="gsis">GSIS</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats5" value="0">
<td><input name="stats5" type="checkbox" id="senior"  value="senior citizen">Senior-Citizen</td>


<tr>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats6" value="0">
<td><input name="stats6" type="checkbox" id="dep"  value="Dependent">Dependent</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats7" value="0">
<td><input name="stats7" type="checkbox" id="emp" value="Employee">Employee</td>
<td><font size="3"></td>
<td></td>
<input type='hidden' name="stats8" value="0">
<td><input name="stats8" type="text" id="" maxlength="15" value="<?php echo $row["STAT8"]; ?>" >Others</td>

</tr>

<tr>
<td><font size="3">Admitting/Attending Nurse</td>
<td>:</td>
<td><input name="nurse" type="text" maxlength="15" value="<?php echo $row["NURSE"]; ?>"></td>

</tr>

  <tr>

<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Update"></td>

</form>



</tr>
</table>
</td>
</form>
</tr>
</table>




<?php } ?>

Then finally the update.php

<?php
$con = mysql_connect("localhost","","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("Hospital", $con);

mysql_query("UPDATE t2 SET HOSPNUM ='$_POST[hnum]', ROOMNUM='$_POST[rnum]', ADATE='$_POST[adate]',  ADTIME='$_POST[adtime]', LASTNAME='$_POST[lname]', FIRSTNAME='$_POST[fname]', MIDNAME='$_POST[mname]', CSTAT='$_POST[cs]', AGE='$_POST[age]', BDAY='$_POST[bday]', ADDRESS='$_POST[ad]', SEX='$_POST[sex]', 
                                                                                                                                                                                                                                                                                                       STAT='$_POST[stats1]', STAT2='$_POST[stats2]', STAT3='$_POST[stats3]', STAT4='$_POST[stats4]', STAT5='$_POST[stats5]', STAT6='$_POST[stats6]', STAT7='$_POST[stats7]', STAT8='$_POST[stats8]', NURSE='$_POST[nurse]'              
WHERE PNUM ='$_POST[pnum]'");


echo "<script>alert('Data Successfully Updated')</script>";
mysql_close($con)
?>

The problem is, I didn’t show the text box corresponding to the pnum(primary key) to prevent it from being updated. Do you know of any technique that would not allow the pnum to be updated even if the text box corresponding to it is shown?

  • 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-13T18:45:48+00:00Added an answer on May 13, 2026 at 6:45 pm

    if you don’t want to update it, but still need it in your query you can do:

    UPDATE `table` SET `col` = `col` WHERE `id` = …
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 295k
  • Answers 295k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You may try gappproxy http://code.google.com/p/gappproxy/ But since the keyword gappproxy… May 13, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer Check your background images. The image bg_facility_rentals.jpg contains "All areas...… May 13, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer The problem was that the temp file was being deleted… May 13, 2026 at 6:46 pm

Related Questions

I've been doing some web development work in PHP recently which has led me
Update, Solved: After all this I found out that I was calling an old
I am looking for a way to extract / scrape data from Word files
Below is the current code I use to get the total number of photos
If I have a table in MySQL which represents a base class, and I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.