Jump to content

get variables from page to page


ramiwahdan

Recommended Posts

16 minutes ago, ramiwahdan said:

Hi,

I have a form that has start date and end date in the form plus link to generate a report. the link will go to other page but i need to be able to get the values of the 2 date fields from the first page. how to do that?

<?php
						
							while($row=mysqli_fetch_assoc($result))
							{
								
								$userid = $row['OracleID'];
								$name = $row['StaffName'];
								$des = $row['Des'];
						
						?>
						
						<tr>
						
							<td><?php echo $userid ?></td>
							<td><?php echo $name ?></td>
							<td><?php echo $des ?></td>
							<td><input type="date" name="startdate"></td>
							<td><input type="date" name="enddate"></td>
							<td><a href="reportbyidbydate.php?GetID=<?php echo $userid?>&startdate=<?php echo $startdate?> ">Print Full Report</a></td>
						
						</tr>
						
						<?php
						
							}
						
						?>

i am trying to use the get method but for startdate i am not sure how to reference it from the input field

Link to comment
Share on other sites

1 hour ago, requinix said:

Use a form, not a link.

I am using the link to get the exact information of specific user in the db, from that I will generate a report of attendance. I am trying to have 2 fields of dates (Start and End) so that then i will go to next page and use that information to get the reports based on the selected dates.

from 3-1-2020 to 3-15-2020, this will generate report of attendance from 3-1-2020 until 3-15-2020 instead of getting all dates. That is my aim. so i am using the link to refer to the right user by his id.

Is there a better way.

 

screenshot attached, this is getting all dates i need the admin to put 2 dates "From and To" then generates based on selection.

 

screen.png

Edited by ramiwahdan
more info
Link to comment
Share on other sites

31 minutes ago, ramiwahdan said:

I am using the link to get the exact information of specific user in the db, from that I will generate a report of attendance. I am trying to have 2 fields of dates (Start and End) so that then i will go to next page and use that information to get the reports based on the selected dates.

from 3-1-2020 to 3-15-2020, this will generate report of attendance from 3-1-2020 until 3-15-2020 instead of getting all dates. That is my aim. so i am using the link to refer to the right user by his id.

Is there a better way.

 

screenshot attached, this is getting all dates i need the admin to put 2 dates "From and To" then generates based on selection.

 

screen.png

i solved it with only one problem, if i choose 3-1-2020 to 3-15-2020 i get only one record excluding the 3-15-2020 but i put 3-1-2020 to 3-16-2020 i get both, there is 1 day difference why is that?

code :

		$sdate1 = $_POST['sdate'];
		$edate1 = $_POST['edate'];
							
		$query = "select * from attendance_records where OracleID = '".$userid."' and isdone= '".$isdone."' and ClockingInDate >= '".$sdate1."' and ClockingOutDate <= '".$edate1."'";
		$result = mysqli_query($con, $query);

where clockingindate is start date in DB, clockingoutdate is end date in DB. sdate and edate are taken from admin user in the form.

Edited by ramiwahdan
more clear info
Link to comment
Share on other sites

14 minutes ago, requinix said:

I'm not sure I followed that question but I think the right reply is something like "if you enter 3-15-2020 as the date then what is the time?"

that is what i suspected but how to get the timestamp from date picker in php forms then?

Link to comment
Share on other sites

1 minute ago, requinix said:

Remember what I said about using a form?

Use a form.

yes i did, I am using a form but putting the type to date gives me to pick dates only with no time.

code:
 

<form action="#" method="post">

	<input type="date" name="sdate" required="required"></input>
	<input type="date" name="edate" required="required"></input>
	<input type="submit" name="saveit" value="Generate"></input>
	
</form>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.