Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Variables from URL $_GET

Variables from URL $_GET

From: stephane <stephane.vollet_at_bluewin.ch>
Date: Wed, 5 Apr 2006 20:53:35 +0200
Message-ID: <44341223_2@news.bluewin.ch>


I have a problem which must be in this :

  print" <script type='text/javascript'>    document.location.replace('http://127.0.0.1/add_task.php?req_id={$maxValue}&tk_request_name={$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_name']; ?>

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.YYYY'),
to_date('05.04.2006','DD.MM.YYYY'),'tasque 2',1000)

I can see that I miss "task_request_id"...

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>Reporting System Demand Management</title>

<script language="JavaScript" src="javascript/overlib_mini.js"></script>

<?php

include ("javascript/function_calendar.js"); ?>

</head>

<body>
<?php

// variable name of submit button in request form

$addrequest = $_POST['addrequest'];

print "$addrequest <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_id = $_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_expected_date'];

 $req_comment = $_POST['request_comment'];

 $c1=oci_connect("stephane","Stef1975",$bdtest05);

 $query="insert into requests (
  request_name, request_date, request_client_id, request_request_type_id,   request_brand_id, request_wished_delivery_date, request_comment)   values
  ('$req_name',to_date('$req_date','DD.MM.YYYY'),$req_client_id,$req_req_type_id,   $req_brand_id,to_date('$req_exp_date','DD.MM.YYYY'),'$req_comment')";

 $stmt=oci_parse($c1,$query);

 Print "$stmt <BR>"; // for testing
 Print "$query <BR>";

 If (oci_execute($stmt)){

  // fermer les connections et libérer les variables avant de partir de cette page
  oci_free_statement($stmt);

  print "add_task.php?request_name=$req_name";// test

  $query="select seq_request_id.currval from dual";   //select max(request_id) from requests;

  $stmt=oci_parse($c1,$query);

  oci_execute($stmt);

  oci_fetch($stmt);

  $maxValue= oci_result($stmt,1);

  oci_free_statement($stmt);

  print" <script type='text/javascript'>    document.location.replace('http://127.0.0.1/add_task.php?req_id={$maxValue}&tk_request_name={$req_name}');    </script>";

  exit;
  }
 else{
  print "insert on Tasks failed";

    }

    }

?>
<center><h1>Add Request</h1></p></center>
<hr>

<p align="center">

  &nbsp;

<form method="POST" name="requestform" action="add_request.php">
  <table border="1" width="50%">
    <tr>

      <td align="left" width="50%" height="25">
         <p align="left">Request Name</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
         <p align="left"><input type="text" size="40" 
name="request_name">&nbsp<b>*</b>&nbsp</p>
      </td>

    </tr>
    <tr>
      <td align="left" width="50%" height="25">
         <p align="left">Request Date</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
         <p align="left"><input type="text" size="20" 
name="request_date">&nbsp<b>*</b>&nbsp;&nbsp;   <a
href="javascript:show_calendar('requestform.request_date',null,null,'DD.MM.YYYY');" onMouseOver="window.status='Date Picker'; overlib('Click here to choose a date from a one month pop-up calendar.'); return true;" onMouseOut="window.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">Client Name</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
         <p align="left">
  <select name="request_client_name" size="1">
          <option>Client Name</option>

<?php

//connection to database

$c1=oci_connect("stephane","Stef1975",$bdtest05);

$query="select client_id, client_firstname||' '||client_lastname as client_fullname from clients";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM)) {
 echo"<option value=$row[0]>$row[1]</option>"; }

oci_free_statement($stmt);
?>

        </select>&nbsp<b>*</b></p>
      </td>

    </tr>
    <tr>
      <td align="left" width="50%" height="25">
        <p align="left">Request Type</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
        <p align="left">
  <select name="request_type" size="1">
          <option>Request Type</option>

<?php

$query="select request_type_id, request_type_name from request_types";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM)) {
 echo"<option value=$row[0]>$row[1]</option>"; }

oci_free_statement($stmt);

?>

        </select>&nbsp<b>*</b>
       </p>
      </td>

    </tr>
    <tr>
      <td align="left" width="50%" height="25">
        <p align="left">Brand Name</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
        <p align="left">

  <select name="request_brand_name" size="1">  <option>Brand Name</option>

<?php

$query="select brand_id, brand_name from brands";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM)) {
 echo"<option value=$row[0]>$row[1]</option>"; }

oci_free_statement($stmt);

//close connection to database

oci_close($c1);
?>

        </select>
        </p>
      </td>

    </tr>
    <tr>
      <td align="left" width="50%" height="25">
        <p align="left">Expected Delivery Date</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
         <p align="left"><input type="text" size="20" 
name="request_expected_date">&nbsp<b>*</b>&nbsp;&nbsp;   <a
href="javascript:show_calendar('requestform.request_expected_date',null,null,'DD.MM.YYYY');" onMouseOver="window.status='Date Picker'; overlib('Click here to choose a date from a full year pop-up calendar.'); return true;" onMouseOut="window.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">Comment on Request</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2"><textarea 
name="request_comment" 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"><input type="submit" name="addrequest" value="add 
request">
        </p>
      </td>
      <td align="left" width="25%" height="25">
        <input type="reset" name="resetButton" value="Reset">
      </td>

    </tr>
  </table>
</form>
<p align="left"></p>
<hr>

<div id="overDiv" style="position:absolute; visibility:hidden;
z-index:1000;"></div>

<p align="center">[Home]</p>

</form>
</body>

</html>

file2___________________________________________________________

<html>
<head>

<link href="../withStyle.css" rel="stylesheet" type="text/css">

<title>Reporting System Demand Management</title>

<script language="JavaScript" src="javascript/overlib_mini.js"></script>

<?php

include ("javascript/function_calendar.js"); ?>

</head>
<body>

<?php

$tk_req_id = $_GET['req_id'];
//$tk_req_id = 1;
?>

<?php

$tK_req_name = $_GET['tk_request_name']; ?>

<?php print "$tK_req_name"; ?>

<?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_date']; print "$tk_start_date = start date <br>";

 $tk_end_date = $_POST['task_end_date']; print "$tk_end_date = end date <br>";

 $tk_fulfil_id = $_POST['task_fulfiller_name']; print "$tk_fulfil_id = id_fulfiller <br>";

 $tk_duration = $_POST['task_duration']; print "$tk_duration = task duration <br>";

 $c1=oci_connect("stephane","Stef1975",$bdtest05);

// 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_start_date','DD.MM.YYYY'),   to_date('$tk_end_date','DD.MM.YYYY'),'$tk_name',$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_statement($stmt);

  print" <script type='text/javascript'>    document.location.replace('http://127.0.0.1/add_task.php?tk_request_name={$tk_req_name}&req_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>Add Task</h1></p></center>
<hr>

<p align="center">

<form name="taskform" method="POST" action="add_task.php">
  <table border="1" width="45%">
    <tr>

      <td align="left" width="50%" height="25">Request name
      </td>
      <td align="left" width="50%" height="25" colspan="2">
 &nbsp;<?php print "$tK_req_name"; ?>

      </td>
    </tr>
    <tr>

      <td align="left" width="50%" height="25">
       <p align="left">Task Name</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
       <p align="left"><input type="text" size="35" 
name="task_name">&nbsp;<b>*</b></p>
      </td>

    </tr>
    <tr>
      <td align="left" width="50%" height="25">
        <p align="left">Task Start Date</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
        <p align="left"><input type="text" size="12" 
name="task_start_date">&nbsp;&nbsp;
  <a
href="javascript:show_calendar('taskform.task_start_date',null,null,'DD.MM.YYYY');" onMouseOver="window.status='Date Picker'; overlib('Click here to choose a date from a one month pop-up calendar.'); return true;" onMouseOut="window.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">Task End Date</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
            <p align="left"><input type="text" size="12" 
name="task_end_date">&nbsp;&nbsp;
  <a
href="javascript:show_calendar('taskform.task_end_date',null,null,'DD.MM.YYYY');" onMouseOver="window.status='Date Picker'; overlib('Click here to choose a date from a one month pop-up calendar.'); return true;" onMouseOut="window.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">Fulfiller Name</p>
      </td>
      <td align="left" width="50%" height="25" colspan="2">
            <p align="left">
  <select name="task_fulfiller_name" size="1">
          <option selected>Fulfiller Name</option>

<?php

//connection to database

$c1=oci_connect("stephane","Stef1975",$bdtest05);

$query="select fulfiller_id, fulfiller_firstname||' '||fulfiller_lastname as fulfiller_fullname from fulfillers";

$stmt=oci_parse($c1,$query);

oci_execute($stmt);

while ($row = oci_fetch_array($stmt,OCI_NUM)) {
 echo"<option value=$row[0]>$row[1]</option>"; }

oci_free_statement($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_duration"> 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"><input type="submit" name="addtask" value="Add 
Task">
        </p>
      </td>
      <td align="left" width="26%" height="25">
        <input type="reset" name="resetButton" value="Reset">
      </td>

    </tr>
  </table>
 </form>

<h2>Tasks List of above request</h2>

<?php

$query="select c.task_id

       ,a.fulfiller_firstname||' '||a.fulfiller_lastname as fullname
       ,b.request_type_name
       ,c.task_name
       ,c.task_start_date
       ,c.task_end_date
       ,e.client_firstname||' '||e.client_lastname as clientname
  from fulfillers a
       ,request_types b
       ,tasks c
       ,requests d
       ,clients e
 where c.task_fulfiller_id = a.fulfiller_id
   and c.task_request_id = d.request_id
   and d.request_request_type_id = b.request_type_id
   and d.request_client_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($stmt);

$nbcolumns = oci_num_fields ($stmt);

?>

<p align="center">

<table border="1" width="100%">

  <tr>

    <th width="10%">Task Number</td>
    <th width="15%">Fulfiller Name</td>
    <th width="15%">Request Type</td>
    <th width="25%">Task Name</td>
    <th width="10%">Start Date</td>
    <th width="10%">End Date</td>
    <th width="15%">Client 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_statement($stmt);
oci_close($c1);

?>

</table>

<?php

// if the Query doesn't return a result, it showes this message if($it==0)
{

 print"&nbsp;";
 print"<pre>there is no task related to this request</pre>";
 print"&nbsp;";

}

?>

<p align="left">&nbsp;</p>
<hr>

<!-- this line is required for the calendar function -->
<div id="overDiv" style="position:absolute; visibility:hidden;
z-index:1000;"></div>

<p align="center">[Home]&nbsp;&nbsp; <a
href="reporting.htm">[Reporting]</a>&nbsp;&nbsp;&nbsp;
<a href="add_request.php">[Add Request]</a></p>

</body>
</html>
Received on Wed Apr 05 2006 - 13:53:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US