473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

variables from URL $_GET

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'),$re q_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.reques t_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.reques t_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"><a href="index.htm">[Home]</a></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',$t k_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_star t_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"><a href="index.htm">[Home]</a>&nbsp;&nbsp; <a
href="reporting.htm">[Reporting]</a>&nbsp;&nbsp;&nbsp;
<a href="add_request.php">[Add Request]</a></p>

</body>
</html>
Apr 5 '06 #1
1 2130
You are correct..

'http://127.0.0.1/add_task.php?req_id={$maxValue}&
^^^^^^^^^^
you are pointing your PHP to localhost - and for the browser, localhost
is their PC not your server. change this to your SERVER IP
address/name

Apr 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dSchwartz | last post by:
This may not be a big deal, but I'm just kinda curious. If I have a page that submits a form to itself, when is it better to assign each element in $_POST to a variable to use for the rest of the...
4
by: Michael J. Astrauskas | last post by:
Does anyone have a function for manipulating GET variables in a URL? I want to be able to modify some parameters without affecting others. An example of what I'm looking for: Let's say the...
10
by: Onideus Mad Hatter | last post by:
Take a look at this: http://www.backwater-productions.net/npindex/index.php Click "Nintento", "A", and then click "Adventures In The Magic Kingdom" o_O Why does it suddenly lose the system...
3
by: Dariusz | last post by:
I have a problem where I need to pass two variables using GET from a form I have, to solve a page selection problem I have. The code is written that if a new visitor arrives at the front page of...
4
by: NK | last post by:
Hi all, how do i create an SQL with variables that are sourced from a form? My code obviously aint happy with it :) $query = "SELECT * FROM itrader_games WHERE console = ".$console." AND...
0
by: James | last post by:
Hi, I am trying to build a shopping cart for my DVD website and am having trouble reading variable over different pages. I have a page that allows the user to add things to their cart and this...
7
by: Angelos | last post by:
hello there... I would like to ask if there is any way of using variables which are outside functions in the functions without passing them when I call the function... Complicated eehh ? I have...
10
by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on search.php, data is received and stored in variables...
8
by: pgt | last post by:
I have a working couple of pages (form submits 2 variables to the second page using GET). page1 has two dropdowns (generated from MySQL db). page2 retrieves info from the database accordingly,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.