how to add/save , modify, delete, view the records

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sreehari
Forum Newbie
Posts: 1
Joined: Thu Dec 01, 2005 2:55 am

how to add/save , modify, delete, view the records

Post by sreehari »

hi

i am developing an application in php. i created a part of it. now i am facing some problems with the code. i need some assistance from u guys.

please go through the code:

Basically,

how to add a record and that should be updated in the database

slly, how to modify and how to delete records.

for modify and delete. i used the radio button for selection and upon selection how to delete or modify that record.

please go through the code and help me.

thx in advance,

sree(hariroy@myway.com)

Code: Select all

<HTML>
<BODY>
<FORM METHOD="POST" ACTION="PAGE2.PHP">
<TABLE WIDTH="100%" BORDER=2 CELLSPACING=0 CELLPADDING=0>
	<TR>
		<TD  width="40%"><STRONG>Service</STRONG></TD>
		<TD width="60%"><STRONG>Description</STRONG></TD>
	</TR>
	<TR>
		<TD><INPUT type=radio  value=r1 id=radio1 name=radio1>Broadcast 
             Service </TD>
		<TD>General Operation Broadcast to ISGN'S</TD>
	</TR>
	<TR>
		<TD width="40%"><INPUT type=radio  value=r1 id=radio2 name=radio1>Contact details of ISGN'S</TD>
		<TD width="60%">Contact Details to all the ISG'S across the Globe</TD>
	</TR>
	<TR>
		<TD width="40%"><INPUT type=radio  value=r1 id=radio3 name=radio1>Demo Site 
              maintenance</TD>
		<TD width="60%">Demo sites updation and maintenance</TD>
	</TR>
	<TR>
		<TD width="40%"><INPUT type=radio  value=r1 id=radio4 name=radio1>&nbsp;Travel 
              Authorisation/Purpose</TD>
		<TD width="60%">Incident ID creation for all the business travel</TD>
	</TR>
	<TR>
		<TD width="40%"><INPUT type=radio  value=r1 id=radio5 name=radio1>Product 
               Service-RMC</TD>
		<TD width="60%">Product support of RMC in contex with functionality and all other product 
               related services.</TD>
	</TR>
	<TR>
		<TD width="40%"><INPUT type=radio  value=r1 id=radio6 name=radio1>Product 
                 Service-NMDC</TD>
		<TD width="60%">Product support of National Mineral Development Corporation(NMDC) Hyderabad 
                 India,project in contex with functionality and all other 
                 product related services.</TD>
	</TR>
</TABLE>
<BR>
<BR>
<BR>
<CENTER><INPUT type=SUBMIT value=ADD><INPUT type=button value=MODIFY><INPUT type=button value=VIEW><INPUT type=button value=DELETE></CENTER>


</FORM>
</BODY>
</HTML>


///page2.php

<HTML>
<head>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--

Sub button1_onclick
document.frmTest.action = "fpage.php"
document.frmTest.submit
End Sub

-->
</SCRIPT>
</head>
<BODY>
<?
$dbhost = 'localhost';
$dbuser = 'www';
$dbpass = '';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die 
                     ('Error connecting to mysql');

$dbname = 'service';
mysql_select_db($dbname);
?> 
<form name="frmTest" method=post action="pa2.php">
<center>
<table>
<tr>
<tr>
<tr>
<tr>
<td>Service<td><input name=text >
<tr>
<td>Catalogue ID<td><input name=text ></td>

<td>
      
</td>
</tr>

<tr>
<td>Department
<td><SELECT style="WIDTH: 176px; HEIGHT: 60px" 
      multiple size=2> <OPTION selected> SELECT</OPTION>

<?
$q1="Select * from department";
$res=mysql_query($q1);
while($row=mysql_fetch_array($res,MYSQL_ASSOC))
  {
   echo '<option value="' . $row[dept] . '">' . $row[dept] . '</option>';
    
    }


mysql_close($conn);
?>

</SELECT><table width="200" border="1">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

</td>

</table>
<BR>
<BR>
<BR>
<INPUT type=SUBMIT value=SAVE><INPUT type=button value=Back id=button1 name=button1>
</center>
</BODY>
</HTML>
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

http://www.ooer.com/index.php?section=php&id=8 .. all the basics of PHP and MySQL. And a little more.
Post Reply