almightyegg Posted June 24, 2007 Share Posted June 24, 2007 I have message board post IDs like 34.148 or gdis.9834 the bit before the full stop is the forum ID and the bit after is the post ID. What I need to do is select the forum ID and the post ID separately (without the full stop) how would I do this? Quote Link to comment Share on other sites More sharing options...
trq Posted June 24, 2007 Share Posted June 24, 2007 <?php $s = "gdis.9834"; $arr = explode('.',$s); echo "forum id = " . $arr[0]; echo "post id = " . $arr[1]; ?> Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 24, 2007 Author Share Posted June 24, 2007 <form action="viewthread.php?f=<? echo "$fid"; ?>&t=<? echo "$tid"; ?>" method="GET"> <b>Input a Thread ID and jump straight to it:</b><br> Thread ID <input type="text" name="t"> <input type="submit" value="Jump to Thread"> <? $pos = $_GET['t']; $arr = explode('.',$pos); $fid = $arr[0]; $tid = $arr[1]; ?> </form> It doesn't seem to work in this.... Quote Link to comment Share on other sites More sharing options...
trq Posted June 24, 2007 Share Posted June 24, 2007 It doesn't seem to work in this.... What exactly do you expect that code to do? Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 24, 2007 Author Share Posted June 24, 2007 To jump straight to the thread that the user requests. It gets the forum, and the thread then it should put them into a link like so viewthread.php?f=forumID&t=threadID but instead it does viewthread.php?t=threadID.forumID Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 24, 2007 Share Posted June 24, 2007 Then your code is incomplete and structured wrongly, isn't it. Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 24, 2007 Author Share Posted June 24, 2007 But I don't understand what's wrong with it <form action="viewthread.php?<? echo "f=$fid&t=$tid"; ?>" method="GET"> That's the line that makes the link and it is there....the only thing I can think of is it is remembering what used to be there. It used to be: <form action="viewthread.php?<? echo "&t=$pos"; ?>" method="GET"> but then I changed the setup of all my IDs in the tables today Quote Link to comment Share on other sites More sharing options...
chigley Posted June 24, 2007 Share Posted June 24, 2007 Look at it, you define the variables after you try to echo them... Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 24, 2007 Author Share Posted June 24, 2007 I always defined $pos after echoing them and it worked, because it needs to complete the form before looking at the link Quote Link to comment Share on other sites More sharing options...
almightyegg Posted June 24, 2007 Author Share Posted June 24, 2007 Does anybody know how to do this?? Not necessarily using my script but basically I need an imput box where you enter ForumID.ThreadID and it turns it into a link like viewthread.php?f=ForumID&t=ThreadID 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.