jeff5656 Posted April 23, 2009 Share Posted April 23, 2009 Inside a while loop, I have a different record, with a unique id. So I want to process a script and have it return to that same position. I realize I need to name it first: <a name="foo" href="newbundle.php?action=edit&id=<?php echo $row['id_incr']; ?>">click here to process</a> I know I need to put this in to return: header("Location: ../../mc/displayactive.php#foo"); But how do I have it return that specific record that the user had originally clicked? Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/ Share on other sites More sharing options...
.josh Posted April 23, 2009 Share Posted April 23, 2009 pass the id back and requery? Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/#findComment-817511 Share on other sites More sharing options...
tang Posted April 23, 2009 Share Posted April 23, 2009 Suggest that you use something like this: <a id="foo<?php echo $row['id_incr']; ?>" href="newbundle.php?action=edit&id=<?php echo $row['id_incr']; ?>">click here to process</a> Then you can just redirect to URL#foo<?php echo $row['id_incr']; ?> EDIT: To confirm, you shouldn't just use $row['id_incr'] as the link id as id's must not begin with a number to be valid xhtml. Doesn't have to be "foo" obviously, name it something short and relevant, just a single letter before the numbers is fine. Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/#findComment-817518 Share on other sites More sharing options...
jeff5656 Posted April 23, 2009 Author Share Posted April 23, 2009 Do I do <a id="foo... or <a name="fo...?? Because I didn't know you could have two ID's inthe saem a href. Sorry if thats a stupid question, but I thought I had to use name="" not id="". Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/#findComment-817531 Share on other sites More sharing options...
.josh Posted April 23, 2009 Share Posted April 23, 2009 tang is suggesting you append the id to foo, so it will end up looking like id="foo123" Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/#findComment-817532 Share on other sites More sharing options...
tang Posted April 23, 2009 Share Posted April 23, 2009 I think that name is fine but I tend to use id= because it's valid for any element then (<p>, <div> etc). I think that name= might be links only but not 100%. So yep, name should be fine. Quote Link to comment https://forums.phpfreaks.com/topic/155378-go-back-to-original-point-on-page/#findComment-817545 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.