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 ?? Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/ 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> Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173767 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 ... Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173793 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 Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173805 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 ... ??? Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173830 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,. Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173864 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. Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173879 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) ?? Link to comment https://forums.phpfreaks.com/topic/227550-problem-requesting-id/#findComment-1173898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.