:) this page name is search.php which gets siteID from the databse and show in LISTBOX.

<form action="site_report.php" method="post">

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

mysql_select_db("onm", $con);
$query="SELECT SiteId FROM SitePInfo WHERE Region='Central 1' ";
$result = mysql_query ($query); 


                    echo "<select name='SiteId'>\n"; 
                   echo       "<option value=''>Select One</option>\n"; 
                       while($nt=mysql_fetch_array($result)) 
					{ 
                echo  "<option value='$nt[SiteId]'>$nt[SiteId]</option>\n"; 
						} 
						echo "</select>"; 
                  ?>
<input type="submit" value="Search ID" />
</form>

and here is site_report.php which show report.

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

$a= $_POST["SiteId"];
mysql_select_db("onm", $con);

$result = mysql_query("SELECT * FROM sitepinfo
WHERE SiteId='$a' ");


while($row = mysql_fetch_array($result))
  {
  echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>


</tr>";
  echo "<tr>";
  echo "<th bgcolor=#5D9BCC >SiteID</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
  
  
 
  

  echo "</tr>";
  echo "<tr>";
			
						
  echo "<th bgcolor=#5D9BCC>Alias</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
  
    echo "</tr>";
	
	echo "<tr>";
  echo "<th bgcolor=#5D9BCC>Longitude</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
    echo "</tr>";
	
	echo "<tr>";
  echo "<th bgcolor=#5D9BCC>Latitude</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>";
    echo "</tr>";
	
	
	 	
	 echo "<tr>";
	echo "<th bgcolor=#5D9BCC>Agreement</th>";
	 echo "<td bgcolor=#9BCB5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";
	  

	  echo "</tr>";
	  
	  
	    echo "<tr>";
	echo "<th bgcolor=#5D9BCC>Purchase Order</th>";
	 echo "<td bgcolor=#CB9B5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";

	  echo "</tr>";
	  
	   echo "<tr>";
	 echo "<td bgcolor=#9B5DCA><a href='update.php?id={$row[SiteId]}'>".stripslashes(Update)."</a>
	   </td>";
	
	  echo "</tr>";
	  
	  echo "<tr>";
	 echo "<td bgcolor=#9B5DCA><a href='delete.php?id={$row[SiteId]}'>".stripslashes(delete)."</a>
	   </td>";
	
	  echo "</tr>";
  }
echo "</table>";


mysql_close($con);

?>

now this i a form for update page name is form.php

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

mysql_select_db("new", $con);

$result = mysql_query("SELECT * FROM abc
WHERE SiteId='C-SIL-4441' "); // I just get one value at this time


while($row = mysql_fetch_array($result))
  {
  echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>


</tr>";
  echo "<tr>";
  echo "<th bgcolor=#5D9BCC >SiteID</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>"; // show value in cell

 
 $b =$row['SiteId']; 
  $c =$row['Name'];
   $d =$row['Address'];
    $e =$row['City'];// store value in $b
 



  
 
  

  echo "</tr>";
 
  }
echo "</table>";


mysql_close($con);

?>
<form action="update2.php" method="post">
<table>
<tr>
<td>name</td>
<td>
<input type="text" name="username" id="username" value="<?php echo $c; ?>" /> </td></tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address" id="address" value="<?php echo $d; ?>"></td></tr>
<tr>
<td>city</td>
<td>
<input type="text" id="city" name="city" value="<?php echo $e; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Update"/>
</td>
</tr>
<input type="text" value="<?php echo $b; ?>" name="siteid">
</table>

</body>
</html>

and last page is update2.php

which gets the value from form.php and update in DB.

I have a problem how I post the
site_report.php siteid into form.php field?

try this one..put in the form.

<input type="hidden"name="id"  value='<?php echo $id; ?>   />

after

$id=$_POST['id'];

:) this page name is search.php which gets siteID from the databse and show in LISTBOX.

<form action="site_report.php" method="post">

 <?php


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

mysql_select_db("onm", $con);
$query="SELECT SiteId FROM SitePInfo WHERE Region='Central 1' ";
$result = mysql_query ($query); 


                    echo "<select name='SiteId'>\n"; 
                   echo       "<option value=''>Select One</option>\n"; 
                       while($nt=mysql_fetch_array($result)) 
                    { 
                echo  "<option value='$nt[SiteId]'>$nt[SiteId]</option>\n"; 
                        } 
                        echo "</select>"; 
                  ?>
<input type="submit" value="Search ID" />
</form>

and here is site_report.php which show report.

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

$a= $_POST["SiteId"];
mysql_select_db("onm", $con);

$result = mysql_query("SELECT * FROM sitepinfo
WHERE SiteId='$a' ");


while($row = mysql_fetch_array($result))
  {
  echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>


</tr>";
  echo "<tr>";
  echo "<th bgcolor=#5D9BCC >SiteID</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";





  echo "</tr>";
  echo "<tr>";


  echo "<th bgcolor=#5D9BCC>Alias</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";

    echo "</tr>";

    echo "<tr>";
  echo "<th bgcolor=#5D9BCC>Longitude</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
    echo "</tr>";

    echo "<tr>";
  echo "<th bgcolor=#5D9BCC>Latitude</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>";
    echo "</tr>";



     echo "<tr>";
    echo "<th bgcolor=#5D9BCC>Agreement</th>";
     echo "<td bgcolor=#9BCB5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";


      echo "</tr>";


        echo "<tr>";
    echo "<th bgcolor=#5D9BCC>Purchase Order</th>";
     echo "<td bgcolor=#CB9B5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";

      echo "</tr>";

       echo "<tr>";
     echo "<td bgcolor=#9B5DCA><a href='update.php?id={$row[SiteId]}'>".stripslashes(Update)."</a>
       </td>";

      echo "</tr>";

      echo "<tr>";
     echo "<td bgcolor=#9B5DCA><a href='delete.php?id={$row[SiteId]}'>".stripslashes(delete)."</a>
       </td>";

      echo "</tr>";
  }
echo "</table>";


mysql_close($con);

?>

now this i a form for update page name is form.php

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

mysql_select_db("new", $con);

$result = mysql_query("SELECT * FROM abc
WHERE SiteId='C-SIL-4441' "); // I just get one value at this time


while($row = mysql_fetch_array($result))
  {
  echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>


</tr>";
  echo "<tr>";
  echo "<th bgcolor=#5D9BCC >SiteID</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
  echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>"; // show value in cell


 $b =$row['SiteId']; 
  $c =$row['Name'];
   $d =$row['Address'];
    $e =$row['City'];// store value in $b








  echo "</tr>";

  }
echo "</table>";


mysql_close($con);

?>
<form action="update2.php" method="post">
<table>
<tr>
<td>name</td>
<td>
<input type="text" name="username" id="username" value="<?php echo $c; ?>" /> </td></tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address" id="address" value="<?php echo $d; ?>"></td></tr>
<tr>
<td>city</td>
<td>
<input type="text" id="city" name="city" value="<?php echo $e; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Update"/>
</td>
</tr>
<input type="text" value="<?php echo $b; ?>" name="siteid">
</table>

</body>
</html>

and last page is update2.php

which gets the value from form.php and update in DB.

I have a problem how I post the
site_report.php siteid into form.php field?

hi
after viewing your code i found one mistake is that you have no give the name of option tag in html right

<?
$result = mysql_query ($query); 
?>
                   <select name='SiteId'> 
<option value=''>Select One</option>         
<?
while($nt=mysql_fetch_array($result)) 
{  ?>
    <option value='<?=$nt[SiteId]?>' name="Siteid" id="Siteid"><?=$nt[SiteId]?></option>
<?
} 
?>
</select>
<input type="submit" value="Search ID" />
</form>

i just edited your code......
you can also use this type of code with php and html so you may reduce some syntex error of php right.
in form.php page
you need to add hidden field as like

<input type="hidden" value=<?=$yoursiteid?> name="siteid" id="siteid"/>

now this value you can accssess dorm update2.php as

$siteid=$_post['siteid'];

and if you want pass the siteid from site_report.php
so you need to declare this hidden tag in this page also ok
Thanks

Thank you so much Tulsa, can I ask one more thing?

ya sure
what thing ?

Dear on update.php page I want to show this message that 1 record is updated successfully and record like this
Id | Name | Address | City |
1 David NY-12 NY


and Excel Export Icon which export this result and save in excel.

Only you help me , thanks for help. thank you so much

i want to learn this .. please check attached file
and can u aslo give some idea about form validation.
for example if i enter wrong values in form.php for updation how it check that its string, date or integer?

hi
welcome no problem
i know solution so i help you
for the view data you can use the simple query na for fetch row right and give one image icon of xls file ok
on click open you need to call xls_data.php file
as i given below one example ok

<img src='xls.jpg' OnClick("javascript:location='xls_data.php'")/>

xls_data.php
now you view the xls file with your all records ok
i give you only example here so asper your requirement you need to chage your table fields

<?	



$query_resume="select * from resume";
				
$result_resume=db_query($query_resume);
$total=db_affected_rows($result_resume);


$i=1;

while($row_resume=db_fetch_array($result_resume))
{							
		$resume_id=$row_resume['resume_id'];
	
	
		$resume_name=trim($row_resume['resume_name']);
		$resume_mail=trim($row_resume['resume_email']);
		$contact=trim($row_resume['resume_mobile']);
		$dob=trim($row_resume['resume_dob']);
		$address=trim($row_resume['resume_address']);
		$pincode=trim($row_resume['resume_pincode']);
		$gender=trim($row_resume['resume_gender']);
		$marital_status=trim($row_resume['resume_marital_status']);
		
$new_row.=" <tr>	
	<td >$i</td>
	 <td >$resume_name</td>
    <td>$address</td>
    <td >$contact_no</td>
    <td >$dob_disp</td>
	<td >$gender</td>
	</tr>";

$i++;
}

$firstrow="
<table  border='2' cellpadding='5' cellspacing='0'>
	<tr bgcolor='#3BB3C2'>
    <td ><b>S.no.</b></td>
    <td ><b>Resume Name</b></td>
    <td><b>Postal Address</b></td>
    <td ><b>Contact   numbers </b></td>
    <td ><b>Date of Birth</b></td>
	<td ><b>Gender</b></td>
    </tr>";

 $resume_data=$firstrow.$new_row."</table>";

$heading_of="
<table border='2'>
<tr>
<td  bgcolor='#3BB3C2'><b>Job Name</b></td>
<td>$jobname</td>
</tr>
<tr>
<td bgcolor='#3BB3C2'><b>Date of Download</b></td>
<td>$cur_date</td>
</tr>
<tr>
<td bgcolor='#3BB3C2'><b>Total Responses</b></td>
<td>$total</td>
</tr>
</table>";


$filename="$newname.xls";

					header("Content-type: application/x-msdownload");
					header("Content-Disposition: attachment; filename=$filename");
					header("Pragma: no-cache");
					header("Expires: 0");
					
					print $heading_of."<br><br>".$resume_data;

?>

Thanks

hi
for the validation you can use spray frame work
which you can download from google and also learn how can use with
the textbox,listbox etx.

and also you use manually validation as client site using javascript and server side using php validation function ok

Thanks

I have designed image in Fireworks and named xls.jpg and saved in www folder but the icon is not clickable .

<img src='xls.jpg' OnClick("javascript<b></b>:location='xls_data.php'")/>

hi
image is show so now you can give this type of code in img tag
and this is good habit that to store images in image folder in the current working directory

<img src="images/xls.jpg" onclick="javascript:location='xls_data.php'" style="cursor:pointer"/>

Thanks

xls_data.php shows this error Fatal error: Call to undefined function db_query() in C:\xampp\htdocs\xls_data.php on line 23

hi
but sorry to say that you have not use you own logic b'cos
this is my own function so you need to use
mysql_query() and
mysql_fetch_data() etc mysql function....

Thanks

I use this code for link and its working .

<a href="xls_data.php"><img src="images/xls.jpg" border="0" /></a>

but xls_data.php is showing error Fatal error: Call to undefined function db_query() in C:\xampp\htdocs\xls_data.php on line 23

Now these types of warnings. plesae make it easy for me. thanks. can i send u code after editing.

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\xls_data.php:10) in C:\xampp\htdocs\xls_data.php on line 87

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\xls_data.php:10) in C:\xampp\htdocs\xls_data.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\xls_data.php:10) in C:\xampp\htdocs\xls_data.php on line 89

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\xls_data.php:10) in C:\xampp\htdocs\xls_data.php on line 90

Headers must be written to the response before the any statement write anything to response.

How?

Please give me a mini example

hi this is a form.php

<html><body><font face=Arial size=2> 
<form method="post" action="contact.php"> 
<table bgcolor=#ffffcc align=center> 
<tr><td colspan=2><strong>Contact us using this form:</strong></td></tr> 
<tr><td>Department:</td><td><select name="sendto"> <option value="info@mycompany.com">General</option> <option value="support@mycompany.com">Support</option> <option value="sales@mycompany.com">Sales</option> </select></td></tr> 
<tr><td><font color=red>*</font> Name:</td><td><input size=25 name="Name"></td></tr> 
<tr><td><font color=red>*</font> Email:</td><td><input size=25 name="Email"></td></tr> 
<tr><td>Company:</td><td><input size=25 name="Company"></td></tr> 
<tr><td>Phone:</td><td><input size=25 name="Phone"></td></tr> 
<tr><td>Subscribe to<br> mailing list:</td><td><input type="radio" name="list" value="No"> No Thanks<br> <input type="radio" name="list" value="Yes" checked> Yes, keep me informed<br></td></tr> 
<tr><td colspan=2>Message:</td></tr> 
<tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=35></textarea></td></tr> 
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr> 
<tr><td colspan=2 align=center><small>A <font color=red>*</font> indicates a field is required</small></td></tr> 
</table> 
</form> 
</body> 
</html>

and this is a contact.php

<?php 
$to = $_REQUEST['sendto'] ; 
$from = $_REQUEST['Email'] ; 
$name = $_REQUEST['Name'] ; 
$headers = "From: $from"; 
$subject = "Web Contact Data"; 

$fields = array(); 
$fields{"Name"} = "Name"; 
$fields{"Company"} = "Company"; 
$fields{"Email"} = "Email"; 
$fields{"Phone"} = "Phone"; 
$fields{"list"} = "Mailing List"; 
$fields{"Message"} = "Message"; 

$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 

$headers2 = "From: noreply@YourCompany.com"; 
$subject2 = "Thank you for contacting us"; 
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com";

if($from == '') {print "You have not entered an email, please go back and try again";} 
else { 
if($name == '') {print "You have not entered a name, please go back and try again";} 
else { 
$send = mail($to, $subject, $body, $headers); 
$send2 = mail($from, $subject2, $autoreply, $headers2); 
if($send) 
{header( "Location: http://www.YourDomain.com/thankyou.html" );} 
else 
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; } 
}
}
?>

it gives following error message

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\contact.php on line 34

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\contact.php on line 35

please help me....

Thanks in advance

please please i have a question, help me dear tulsa

I use this code for link and its working .

<a href="xls_data.php"><img src="images/xls.jpg" border="0" /></a>

but xls_data.php is showing error Fatal error: Call to undefined function db_query() in C:\xampp\htdocs\xls_data.php on line 23

hi
you need to use mysql_query() function rather then db_query() b'cos it's my own function ok
and also you should write all code for the mysql database connect etc for fetch the data in exel sheet ok


Thanks

hi
I view your code i found one mistake is that you can not use
header() function after any other code writen in a file right
So i have a one solution for redirect your page like this

if($send)
{
 echo "\n<meta http-equiv=\"refresh\""." content=\"0;url=/ http://www.YourDomain.com/thankyou.html\">\n";
}

else

{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }

}
}
?>

I hope this code usefull to and your problem may be solve

Thanks

i THINK I HAVE TO CHANGE SOMETHING IN .INI FILE , PLEASE TELL .........

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

please

please help if possible thanks....
whenever u get free

thank u so much

tulsa are u busy?
I have a qustion?
Can I ask?

hi tulsa , i have a question about file uploading. can i make new thread, please

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.