Jump to content

Problem requesting ID


spacepoet

Recommended Posts

Hi:

 

I am trying to request an id to do a transfer back to a page, but am having difficulties.

 

This is on a page where a person can add a new section, which gets assigned a unique id.

 

I am trying to send the user to the page where they can edit the new page, once it has been created.

 

Like this:

 

a_websiteDataADD.php

<?php
$id = $_REQUEST['id'];
?>

...

<script language="JavaScript">
alert("The new section was added!");
location.href = "a_websiteData.php?id=[id]";
</script>

 

What am I missing on this ??

Link to comment
https://forums.phpfreaks.com/topic/227550-problem-requesting-id/
Share on other sites

I'm saying I tried:

<?php
$id = $_REQUEST['id'];
?>
...

<script language="JavaScript">
alert("The new section was added!");
location.href = "a_websiteData.php?id=<?php echo $id; ?>";
</script>

 

Before posting about the error, but it didn't work.

 

I get:

Could not get data from db: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

The URL in the browser looks like:

http://www.rggeneralcontractor.com/admin/a_websiteData.php?id=<?php echo $id; ?>

 

It does insert the data, but the JS is not redirecting - I'm missing the proper syntax ...

???

I can do PHP redirects, but it's the same issue:

header("Location: a_websiteData.php?id=<?php echo $id; ?>");

 

This is already in a PHP tag set - so maybe I just need something like:

header("Location: a_websiteData.php?id=echo $id;");

 

(even though that doesn't work, either)

 

??

 

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.