Jump to content

Query regarding php connection to sqlserver and retriving data


srikanthpv

Recommended Posts

Hi i am new person to this forum and new to php too...Actually my project which i am working for needs following things....

1) create a php page

name & age : (text box ) and a submit button

2) I already connected it to a processing page and then to a sqlserver2005 database

 

here is the code of wat i did

->this is my php page

 

<head>

 

 

<title>Bay area</title>

</head>

 

<body bgcolor="white">

<form name="frm" method="post" action="processtesterpage10.php">

<table>

<tr>

<td>

Name:

</td>

<td>

<input type="text" name="txtname" value=""> <?php print $rs.name ?>

</td>

</tr>

<tr>

<td>

Age:

</td>

<td>

<input type="text" name="txtage" value="">

</td>

</tr>

<tr>

<td colspan="2">

<input type="submit" name="Save" value="Save">

</td>

</tr>

</table>

</form>

</body>

 

</html>

 

 

->Processing page code and connectivity to sqlserver2005

 

<?php

$name = $_POST['txtname'];

$age = $_POST['txtage'];

 

print "My name is : $name<br>My age is : $age";

 

 

$conn=odbc_connect('srikanthdatasource','','');

$sql="INSERT INTO employee VALUES ('" . $name . "','" . $age . "')";

$rs=odbc_exec($conn,$sql);

 

---here employee is my table

 

*********The problem****************

 

I am not able to retrieve back the data to my main from the database like whenever a person comes and enter's his name it should be shown the screen for the next person....How is this possible?????

 

I would be thankful to forum members if you guys help me in this

 

 

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.