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

???

Link to comment
Share on other sites

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)

 

??

 

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.