spacepoet Posted February 13, 2011 Share Posted February 13, 2011 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 ?? Quote Link to comment Share on other sites More sharing options...
lastkarrde Posted February 13, 2011 Share Posted February 13, 2011 <?php $id = $_REQUEST['id']; ?> ... <script language="JavaScript"> alert("The new section was added!"); location.href = "a_websiteData.php?id=<?php echo $id; ?>"; </script> Quote Link to comment Share on other sites More sharing options...
spacepoet Posted February 13, 2011 Author Share Posted February 13, 2011 Hi: Thanks, but I tried that already .. Didn't work ... Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 13, 2011 Share Posted February 13, 2011 Hi: Thanks, but I tried that already .. Didn't work ... See below Quote Link to comment Share on other sites More sharing options...
spacepoet Posted February 13, 2011 Author Share Posted February 13, 2011 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 ... ??? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 14, 2011 Share Posted February 14, 2011 So this is a javascript problem. Personally, I would redirect using php because not everyone has javascript turned on. This just looks sloppy to me,. Quote Link to comment Share on other sites More sharing options...
lastkarrde Posted February 14, 2011 Share Posted February 14, 2011 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 Thats a SQL error, so theres something wrong with your SQL. Quote Link to comment Share on other sites More sharing options...
spacepoet Posted February 14, 2011 Author Share Posted February 14, 2011 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) ?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.