hi,
i had written two programs and those are working fine but my Team Lead wants that two programs to be in one single page. i used post method so if i place it in single page i am getting error. so can anybody...
Thank u.
-----projectcreation.php--------
<html>
<body>
<script language="javascript" type="text/javascript">
function check()
{
if(document.getElementById('txtname').value == "")
{
alert('Please enter projectname');
return false;
}
if(document.getElementById('createdby').value == "")
{
alert('Please enter createdby');
return false;
}
}
</script>
<form action="insertproject.php" method="post">
<table align="center">
<tr>
<td style="color: navy;">projectname</td>
<td><input id="txtname" type="text" name="projectname"></td>
</tr>
<tr>
<td style="color: navy;">allocated memory</td>
<td><input type="text" name="allocatedmemory"></td>
<td><select name="size">
<option value="MB">MB</option>
<option value="KB" selected="selected">KB</option>
</select>
</td>
</tr>
<td></td>
<td><input type="submit" name="btn" value="Submit" onclick="return check();"></td>
</table>
</form>
</body>
</html>
-----insertproject.php------
<?php
$id=$_GET['f1'];
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory,$Remainingmemory,$result);
$con=mysql_connect("10.70.1.248","invensis","invensis");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_myproject",$con);
if($_POST[size]== 'MB')
{
$am=$_POST[allocatedmemory] ;
$result=$am*1024;
}
else{
$am=$_POST[allocatedmemory] ;
$result = $am;
}
if($_POST[size]== 'KB')
{
$am=$_POST[allocatedmemory];
$test=round($am/1024,4);
echo "$test";
}
else{
$am=$_POST[allocatedmemory];
$test=$am;
echo "$test";
}
if( $result < $Remainingmemory)
{
$sql="INSERT INTO projects(projectname,allocatedmemory,createdby)
VALUES ('$_POST[projectname]','$test MB','$_SESSION[username]')";
echo "New Project Added";
if(!mysql_query($sql,$con))
{
die('Error:' . mysql_error());
}
}
else
{
echo "<script language='javascript'>
alert('Insufficient Memory');
</script>";
}
?>
these are the two pages i need to place in single page.