I have a problem which must be in this :
print" <script type='text/javascript'>
document.locati on.replace('htt p://127.0.0.1/add_task.php?re q_id={$maxValue }&tk_request_na me={$req_name}' );
</script>";
or maybe here, in file2
<?php
$tk_req_id = $_GET['req_id'];
//$tk_req_id = 1;
?>
<?php
$tK_req_name = $_GET['tk_request_nam e'];
?>
I have to tell you that at some point it worked, but I did not do anything
different since then...
when I get in add_task.php the "insert" does not work. I get this message :
Add Task
tasque 2 = task name
05.04.2006 = start date
05.04.2006 = end date
2 = id_fulfiller
1000 = task duration
Resource id #4
insert into tasks ( task_request_id , task_fulfiller_ id, task_start_date ,
task_end_date, task_name, task_duration) values (, 2,
to_date('05.04. 2006','DD.MM.YY YY'),
to_date('05.04. 2006','DD.MM.YY YY'),'tasque 2',1000)
I can see that I miss "task_request_i d"...
I really have no idea what's wrong with that. Can you tell please?
Thanks for looking.
file1__________ _______________ _______________ ______
<html>
<head>
<link href="../withStyle.css" rel="stylesheet " type="text/css">
<title>Reportin g System Demand Management</title>
<script language="JavaS cript" src="javascript/overlib_mini.js "></script>
<?php
include ("javascript/function_calend ar.js");
?>
</head>
<body>
<?php
// variable name of submit button in request form
$addrequest = $_POST['addrequest'];
print "$addreques t <BR>";// for testing
//test if something is submited in the form if this is the case then insert
data in DB
if ($addrequest!=' ') {
$req_name = $_POST['request_name'];
$req_date = $_POST['request_date'];
$req_client_id = $_POST['request_client _name'];
$req_req_type_i d = $_POST['request_type'];
$req_brand_id = $_POST['request_brand_ name'];
if ($req_brand_id= ='Brand Name') $req_brand_id=' NULL';
$req_exp_date = $_POST['request_expect ed_date'];
$req_comment = $_POST['request_commen t'];
$c1=oci_connect ("stephane","St ef1975",$bdtest 05);
$query="insert into requests (
request_name, request_date, request_client_ id, request_request _type_id,
request_brand_i d, request_wished_ delivery_date, request_comment )
values
('$req_name',to _date('$req_dat e','DD.MM.YYYY' ),$req_client_i d,$req_req_type _id,
$req_brand_id,t o_date('$req_ex p_date','DD.MM. YYYY'),'$req_co mment')";
$stmt=oci_parse ($c1,$query);
Print "$stmt <BR>"; // for testing
Print "$query <BR>";
If (oci_execute($s tmt)){
// fermer les connections et libérer les variables avant de partir de
cette page
oci_free_statem ent($stmt);
print "add_task.php?r equest_name=$re q_name";// test
$query="select seq_request_id. currval from dual";
//select max(request_id) from requests;
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
oci_fetch($stmt );
$maxValue= oci_result($stm t,1);
oci_free_statem ent($stmt);
print" <script type='text/javascript'>
document.locati on.replace('htt p://127.0.0.1/add_task.php?re q_id={$maxValue }&tk_request_na me={$req_name}' );
</script>";
exit;
}
else{
print "insert on Tasks failed";
}
}
?>
<center><h1>A dd Request</h1></p></center>
<hr>
<p align="center">
<form method="POST" name="requestfo rm" action="add_req uest.php">
<table border="1" width="50%">
<tr>
<td align="left" width="50%" height="25">
<p align="left">Re quest Name</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="40"
name="request_n ame"> <b>* </b> </p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Re quest Date</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="20"
name="request_d ate"> <b>* </b>
<a
href="javascrip t:show_calendar ('requestform.r equest_date',nu ll,null,'DD.MM. YYYY');"
onMouseOver="wi ndow.status='Da te Picker'; overlib('Click here to choose a
date from a one month pop-up calendar.'); return true;"
onMouseOut="win dow.status=''; nd(); return true;"><img
src="show-calendar.gif" width=24 height=22 border=0></a></p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Cl ient Name</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left">
<select name="request_c lient_name" size="1">
<option>Clien t Name</option>
<?php
//connection to database
$c1=oci_connect ("stephane","St ef1975",$bdtest 05);
$query="select client_id, client_firstnam e||' '||client_lastn ame as
client_fullname from clients";
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
while ($row = oci_fetch_array ($stmt,OCI_NUM) )
{
echo"<option value=$row[0]>$row[1]</option>";
}
oci_free_statem ent($stmt);
?>
</select> <b> *</b></p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Re quest Type</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left">
<select name="request_t ype" size="1">
<option>Reque st Type</option>
<?php
$query="select request_type_id , request_type_na me from request_types";
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
while ($row = oci_fetch_array ($stmt,OCI_NUM) )
{
echo"<option value=$row[0]>$row[1]</option>";
}
oci_free_statem ent($stmt);
?>
</select> <b> *</b>
</p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Br and Name</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left">
<select name="request_b rand_name" size="1">
<option>Brand Name</option>
<?php
$query="select brand_id, brand_name from brands";
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
while ($row = oci_fetch_array ($stmt,OCI_NUM) )
{
echo"<option value=$row[0]>$row[1]</option>";
}
oci_free_statem ent($stmt);
//close connection to database
oci_close($c1);
?>
</select>
</p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Ex pected Delivery Date</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="20"
name="request_e xpected_date">& nbsp<b>*</b>
<a
href="javascrip t:show_calendar ('requestform.r equest_expected _date',null,nul l,'DD.MM.YYYY') ;"
onMouseOver="wi ndow.status='Da te Picker'; overlib('Click here to choose a
date from a full year pop-up calendar.'); return true;"
onMouseOut="win dow.status=''; nd(); return true;"><img
src="show-calendar.gif" width=24 height=22 border=0></a></p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Co mment on Request</p>
</td>
<td align="left" width="50%" height="25" colspan="2"><te xtarea
name="request_c omment" cols="30" rows="4"></textarea><p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left"></td>
<td align="left" width="25%" height="25">
<p align="left"><i nput type="submit" name="addreques t" value="add
request">
</p>
</td>
<td align="left" width="25%" height="25">
<input type="reset" name="resetButt on" value="Reset">
</td>
</tr>
</table>
</form>
<p align="left"></p>
<hr>
<div id="overDiv" style="position :absolute; visibility:hidd en;
z-index:1000;"></div>
<p align="center"> <a href="index.htm ">[Home]</a></p>
</form>
</body>
</html>
file2__________ _______________ _______________ _______________ ____
<html>
<head>
<link href="../withStyle.css" rel="stylesheet " type="text/css">
<title>Reportin g System Demand Management</title>
<script language="JavaS cript" src="javascript/overlib_mini.js "></script>
<?php
include ("javascript/function_calend ar.js");
?>
</head>
<body>
<?php
$tk_req_id = $_GET['req_id'];
//$tk_req_id = 1;
?>
<?php
$tK_req_name = $_GET['tk_request_nam e'];
?>
<?php print "$tK_req_na me"; ?>
<?php print "$tk_req_id "; ?>
<?php
// variable name of submit button of request form
$addtask = $_POST['addtask'];
print "$addtask <BR>"; // for testing
//test if something is submited in the form if this is the case then insert
data in DB
if ($addtask!='') {
$tk_name = $_POST['task_name'];
print "$tk_name = task name <br>";
$tk_start_date = $_POST['task_start_dat e'];
print "$tk_start_ date = start date <br>";
$tk_end_date = $_POST['task_end_date'];
print "$tk_end_da te = end date <br>";
$tk_fulfil_id = $_POST['task_fulfiller _name'];
print "$tk_fulfil _id = id_fulfiller <br>";
$tk_duration = $_POST['task_duration'];
print "$tk_durati on = task duration <br>";
$c1=oci_connect ("stephane","St ef1975",$bdtest 05);
// if ($req_brand_id= ='Brand Name') $req_brand_id=' NULL';
// $tk_request_id = ?????request to do
$query="insert into tasks (
task_request_id , task_fulfiller_ id, task_start_date ,
task_end_date, task_name, task_duration)
values ($tk_req_id, $tk_fulfil_id, to_date('$tk_st art_date','DD.M M.YYYY'),
to_date('$tk_en d_date','DD.MM. YYYY'),'$tk_nam e',$tk_duration )";
$stmt=oci_parse ($c1,$query);
Print "$stmt <BR>";
Print "$query <BR>";
If(oci_execute( $stmt)){
// fermer les connections et libérer les variables avant de partir de
cette page
oci_free_statem ent($stmt);
print" <script type='text/javascript'>
document.locati on.replace('htt p://127.0.0.1/add_task.php?tk _request_name={ $tk_req_name}&r eq_id={$tk_req_ id}');
</script>";
};
// gestion du else: erreur dans l'insertion en BD
}
else
{
// $tk_request_id = ????
$tk_name = $_POST['task_name'];
}
?>
<center><h1>A dd Task</h1></p></center>
<hr>
<p align="center">
<form name="taskform" method="POST" action="add_tas k.php">
<table border="1" width="45%">
<tr>
<td align="left" width="50%" height="25">Req uest name
</td>
<td align="left" width="50%" height="25" colspan="2">
<?php print "$tK_req_na me"; ?>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Ta sk Name</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="35"
name="task_name "> <b> *</b></p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Ta sk Start Date</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="12"
name="task_star t_date"> & nbsp;
<a
href="javascrip t:show_calendar ('taskform.task _start_date',nu ll,null,'DD.MM. YYYY');"
onMouseOver="wi ndow.status='Da te Picker'; overlib('Click here to choose a
date from a one month pop-up calendar.'); return true;"
onMouseOut="win dow.status=''; nd(); return true;"><img
src="show-calendar.gif" width=24 height=22 border=0></a>
</p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Ta sk End Date</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left"><i nput type="text" size="12"
name="task_end_ date"> &nb sp;
<a
href="javascrip t:show_calendar ('taskform.task _end_date',null ,null,'DD.MM.YY YY');"
onMouseOver="wi ndow.status='Da te Picker'; overlib('Click here to choose a
date from a one month pop-up calendar.'); return true;"
onMouseOut="win dow.status=''; nd(); return true;"><img
src="show-calendar.gif" width=24 height=22 border=0></a>
</p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left">Fu lfiller Name</p>
</td>
<td align="left" width="50%" height="25" colspan="2">
<p align="left">
<select name="task_fulf iller_name" size="1">
<option selected>Fulfil ler Name</option>
<?php
//connection to database
$c1=oci_connect ("stephane","St ef1975",$bdtest 05);
$query="select fulfiller_id, fulfiller_first name||' '||fulfiller_la stname as
fulfiller_fulln ame from fulfillers";
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
while ($row = oci_fetch_array ($stmt,OCI_NUM) )
{
echo"<option value=$row[0]>$row[1]</option>";
}
oci_free_statem ent($stmt);
?>
</select></p>
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
Task duration</td>
<td align="left" width="50%" height="25" colspan="2">
<input type="text" size="8" name="task_dura tion"> minutes
</td>
</tr>
<tr>
<td align="left" width="50%" height="25">
<p align="left"></td>
<td align="left" width="24%" height="25">
<p align="left"><i nput type="submit" name="addtask" value="Add
Task">
</p>
</td>
<td align="left" width="26%" height="25">
<input type="reset" name="resetButt on" value="Reset">
</td>
</tr>
</table>
</form>
<h2>Tasks List of above request</h2>
<?php
$query="select c.task_id
,a.fulfiller_fi rstname||' '||a.fulfiller_ lastname as fullname
,b.request_type _name
,c.task_name
,c.task_start_d ate
,c.task_end_dat e
,e.client_first name||' '||e.client_las tname as clientname
from fulfillers a
,request_types b
,tasks c
,requests d
,clients e
where c.task_fulfille r_id = a.fulfiller_id
and c.task_request_ id = d.request_id
and d.request_reque st_type_id = b.request_type_ id
and d.request_clien t_id = e.client_id
and c.task_end_date is NULL";// à ne pas mettre
// and d.request_id = $tk_req_id"; // à mettre
$stmt=oci_parse ($c1,$query);
oci_execute($st mt);
$nbcolumns = oci_num_fields ($stmt);
?>
<p align="center">
<table border="1" width="100%">
<tr>
<th width="10%">Tas k Number</td>
<th width="15%">Ful filler Name</td>
<th width="15%">Req uest Type</td>
<th width="25%">Tas k Name</td>
<th width="10%">Sta rt Date</td>
<th width="10%">End Date</td>
<th width="15%">Cli ent Name</td>
</tr>
<?php
while ($row = oci_fetch_array ($stmt,OCI_NUM) )
{
$it=it+1;
echo "<tr>";
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
echo "<td>$row[4]</td>";
echo "<td>$row[5]</td>";
echo "<td>$row[6]</td>";
echo "</tr>";
}
oci_free_statem ent($stmt);
oci_close($c1);
?>
</table>
<?php
// if the Query doesn't return a result, it showes this message
if($it==0)
{
print" ";
print"<pre>ther e is no task related to this request</pre>";
print" ";
}
?>
<p align="left">&n bsp;</p>
<hr>
<!-- this line is required for the calendar function -->
<div id="overDiv" style="position :absolute; visibility:hidd en;
z-index:1000;"></div>
<p align="center"> <a href="index.htm ">[Home]</a> <a
href="reporting .htm">[Reporting]</a> & nbsp;
<a href="add_reque st.php">[Add Request]</a></p>
</body>
</html>