shank888 Posted February 21, 2007 Share Posted February 21, 2007 Hey all. This is my first post and hopefulyl not the last. as well I hope to be helping more then receiving help. anyways here is my problem: I am building my website in a single PHP file. $action = $_GET['action']; $filename = 'index.php'; $host = "myipaddres/index.php"; if($action == 'index2') { echo "<td width='50%'> <a href='$host?action=cat_id=$cat_id&user_id=$user_id'> </td>"; } // Okay so I mate this short little acton script where if someone links the link above it'll show the next page. if($action == 'cat_id=$cat_id&forum_id=$forum_id') { echo "sucess!"; Would someone be able to tell me why this isn't working. like I know it's a problem with the $action varbiable but how would I sucessfully link the to. oh btw I have a working connect to MySQL script running off of this. it's just little code snipplets. any help would be appretiated. Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/ Share on other sites More sharing options...
fert Posted February 21, 2007 Share Posted February 21, 2007 you have an & in the code which creates new get variables. Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190072 Share on other sites More sharing options...
shank888 Posted February 21, 2007 Author Share Posted February 21, 2007 you have an & in the code which creates new get variables. Yes. for sorting purposes I am using the & Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190075 Share on other sites More sharing options...
shank888 Posted February 21, 2007 Author Share Posted February 21, 2007 i do not see this as a problem. Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190095 Share on other sites More sharing options...
fert Posted February 21, 2007 Share Posted February 21, 2007 well now $_GET['action']="cat_id=$cat_tid" and $_GET['amp;user_id']=$user_id; Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190100 Share on other sites More sharing options...
shank888 Posted February 21, 2007 Author Share Posted February 21, 2007 umm okay. so can I simply over right variables sumwheres in a script, then later on have then return to the global variable I'm using everywhere else? As well where would I place this? Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190130 Share on other sites More sharing options...
tom100 Posted February 21, 2007 Share Posted February 21, 2007 Change this line: echo "<td width='50%'> <a href='$host?action=cat_id=$cat_id&user_id=$user_id'> </td>"; to echo "<td width='50%'> <a href='$host?action=cat_id=".urlencode("{$cat_id}&")."user_id=$user_id'> </td>"; Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190134 Share on other sites More sharing options...
shank888 Posted February 21, 2007 Author Share Posted February 21, 2007 Change this line: echo "<td width='50%'> <a href='$host?action=cat_id=$cat_id&user_id=$user_id'> </td>"; to echo "<td width='50%'> <a href='$host?action=cat_id=".urlencode("{$cat_id}&")."user_id=$user_id'> </td>"; Hmm that didn't work. I don't really like giving out my whole code over the net so I made a bigger snippet so it'll be easier to see whats going on <?php // Global Variables /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $action = $_GET['action']; // Determines what page is being displayed $filename = 'index.php'; // Current name of file, eg: index.php $host = "NULL/index.php"; $username_sql = "NULL"; $password_sql = "NULL"; //MySQl Connect $conn=mysql_connect(localhost,$username_sql,$password_sql) or die(mysql_error()); @mysql_select_db("NULL",$conn) or die(mysql_error()); <table cellspacing='1' width='780'> <tr> $query3="SELECT * FROM `NULL` WHERE forum_cat_id = $cat_id"; $result2=mysql_query($query3,$conn); while ($row3=@mysql_fetch_array($result2)) { @extract($row3); echo" <td width='50%'> <a href='$host?action=cat_id=".urlencode("{$cat_id}&")."user_id=$user_id'> <b>$user_name</b><br /></a> $user_desc </td> } echo"</table>"; } } if($action == 'cat_id=$cat_id&user_id=$user_id') { $query4="SELECT * FROM `NULL` WHERE NULL_BLAH_id = $user_id"; $result3= mysql_query($query4,$conn); while ($row4=@mysql_fetch_array($result3)) { @extract($row4); if (@mysql_num_rows($row4) < 1) { //If no topics display this error $display_block = "<p><i>There are currently no users</i></p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190148 Share on other sites More sharing options...
shank888 Posted February 21, 2007 Author Share Posted February 21, 2007 /bump Link to comment https://forums.phpfreaks.com/topic/39403-help-linking/#findComment-190697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.