Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

urgent, date pb

Status
Not open for further replies.

mnassih

IS-IT--Management
Jun 29, 2005
64
SE
I execute the code :
---
<?php

$datedebut = $_POST["datedebut"];
$datefin = $_POST["datefin"];

?>

<form action="demapprobconge.php?datedebut=<?php echo $datedebut;?>&datefin=<?php echo $fin;?>" method="POST">

<center>
<table>

<tr>
<td>
De :
</td>
<td>
<input type="text" name="datedebut" size="10">
</td>
</tr>

<tr>
<td>
A :
</td>
<td>
<input type="text" name="datefin" size="10">
</td>
</tr>
<tr>
<td>
<input type="reset" value="Annuler" />
</td>

<td>
<input type="submit" value="Demander Approbation" />
</td>

</td>
</tr>

</table>
</center>
</form>
----

when I enter the dates and I submit, I got :

in the address, the datedebut and datefin are empty ???

please help.
 
Hi

Why did you put those parameters in the [tt]action[/tt] attribute's URL ?

And while the [tt]form[/tt]'s [tt]method[/tt] is POST, no new values will appear in the URL.

Your code is Ok, should work. I think the problem is with your PHP skill, because looks like you mess up abit the things.

Is the PHP file you posted the same demapprobconge.php to which the data is submitted ? If yes, then indeed, you misunderstand the facts, because :
[ol]
[li]user enters the data into the [tt]form[/tt][/li]
[li]the script generates the next page where the received data will be put in the [tt]form[/tt]'s [tt]action[/tt] attribute[/li]
[li]the page's URL will contain the data entered into the form two steps earlier[/li]
[/ol]
And please post your code between [tt][ignore]
Code:
[/ignore][/tt] and [tt][ignore]
[/ignore][/tt] tags.

Feherke.
 
Why did you put those parameters in the action attribute's URL ?
- I want to pass these parameters to a 2d page for traitment.
 
Hi

Yes, but in the moment when PHP puts them there, the visitor did not entered anything yet in the [tt]form[/tt].

Now mentioning that 2[sup]nd[/sup] page confuses me abit. Could you describe what you want to do ? That 2[sup]nd[/sup] page means
[ul]
[li]the second page the visitor will see, in which case the one containing the [tt]form[/tt] is the first[/li]
[li]the third page the visitor will see, the second page which will receive the same [tt]form[/tt] data, in which case the one receiving the [tt]form[/tt] is the first[/li]
[/ul]
?

Feherke.
 
What feherke is trying to say, is where are these values:
Code:
$datedebut = $_POST["datedebut"];
$datefin = $_POST["datefin"];

supposed to come from, if you haven't submitted the form yet.

If they in fact exist already, then when the form is submitted the values will no longer be in the POST superglobal but in the GET superglobal since you are putting them in the action URL, and not as a form element.

what exactly are you trying to do?

Are you trying to send the values to the page the form is being submitted to?




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
...there is also an undefined reference in there:

$fin
 
if you check out the OP's other post in this forum on a related topic, you will see that he/she has an understanding gap over the behaviour of forms and the related scope of variables. I tried, in that thread, to explain but i think i failed. Perhaps someone else should have a go at running through the basics of http and forum submission.
 
I want just to display the dates entred by the user -in the first form- at the second form. Like : echo $datedebut; echo $datefin,
 
Hi

Then this is enough :
Code:
<html>
<head></head>
<body>

Previously you entered :<br>
De : <?php echo $_POST["datedebut"]; ?><br>
A : <?php echo $_POST["datefin"]; ?><hr>

<form action="demapprobconge.php" method="post">
De : <input type="text" name="datedebut" size="10"><br>
A : <input type="text" name="datefin" size="10"><br>
<input type="reset" value="Annuler">
<input type="submit" value="Demander Approbation">
</form>

</body>
</html>

Feherke.
 
Many thanks Feherke,

Now the problem witch I have is :

- I want to insert in a table in the database these 2 dates and 2 others information like matricule that had before.
- The page demapprobconge.php will just display a message like : A new record was added in the database -or not-.


 
you have been given the answer to this question many times in the other thread you have posted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top