Jump to content

Input _GET into a query.


HarryMW

Recommended Posts

Why exactly is the _get returning just nothing everytime?

$seshid = $_GET['finish'];

// Little things in here ...

///Add lesson plan
if(isset($_POST['addinc'])){

if(!empty($_POST['inc'])){
	$inc = addslashes($_POST['inc']);
	mysql_query("INSERT INTO `group_sessions_lplan` (`group_sessions_lplan_id`, `group_session_id`, `plan`) VALUES ('', '$seshid', '".strip_tags($inc, "<a><b><strong><u><i><span>")."')");

	header("Location: ?id=".$seshid."#I");
	exit();
}
}

 

Not too sure myself, anyone know how I can get it to show its actual value?

 

Link to comment
https://forums.phpfreaks.com/topic/233158-input-_get-into-a-query/
Share on other sites

I'd have to say it may have to do with the way you did your form itself.

 

Could you paste that as well?

 

But to see if your get is passing anything just do like this top your code.

 

$seshid = $_GET['finish'];
echo $seshid;

 

Then we can go from there to see what the problem might be.

Well I have a history page and basically it loops all of the results etc... then the id of the result is passed through to the next page with:

 

<a href="gcomplete.php?finish=<?php echo $row_h['group_session_id']?>">View</a>

 

And if I put the echo at the top (which I did in the begining to check) is echo's the id.

 

I'm just stumped.

Right, BUT, what does your form look like? You're submitting a form to the page or you wouldn't be using $_POST. You would have to pass on that same variable to the form's action page in order for it to work.

<form action="gcomplete.php?finish=<?php echo $row_h['group_session_id']?>" method="post">

As the others have suggested, it would be helpful to see your form. Otherwise we're just guessing.

 

With that said, is your form method GET or POST? You're using both in the code mentioned earlier.

 

<?php
...

$seshid = $_GET['finish'];

...

if(isset($_POST['addinc'])){

...
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.