Jump to content

more variables in the links. D=


Racc

Recommended Posts

I can't edit or del the news I have posted.

 

<?php session_start();
ob_start();
if (isset($_GET['s']))
$s = $_GET['s'];
else
$s = "main";
include("include/container.php");
include("include/header.php");
include("include/nav.php");
?>
<link rel="stylesheet" type="text/css" href="style.css" media="screen"></head>
<title>Racc</title>
<div id="content">
<?php
if ($s == "main") {
include("include/news.php");
} else if ($s == "blog") {
include("include/blog.php");
} /*lololol admin stuff*/
  else if ($s == "admincp") {
include("include/admincp.php");
} /*lololol newsmanaging*/
  else if ($s == "newsmanage") {
include("include/admincp/news_manage.php");
} else if ($s == "addnews") {
include("include/admincp/addnews.php");
} /* lololol blogmanaging*/
  else if ($s == "blogmanage") {
include("include/admincp/blog_manage.php");
} else if ($s == "addblog") {
include("include/admincp/addblog.php");
}
/*lololol end admin stuff*/
  else if ($s == "logout") {
include("include/process.php");
} else if ($s == "downloads") {
include("include/downloads.php");
} else if ($s == "tutorials") {
include("include/tutorials.php");
} else if ($s == "author") {
include("include/author.php");
} else if ($s == "links") {
include("include/links.php");
} else if ($s == "comments") {
include("include/comments.php");
}	else {
echo "<p class=\"error\">The section $s does not exist!</p>\n";
}
?>
</div>
</body>
</html>
<?php
ob_end_flush();
?>

 

That's my index, that's how I do my links.

 

<?php
include('include/session.php');
if(!isset($_SESSION['userid'])){
?>
<br><br>
<form action="include/process.php" method="POST">
Username:<input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr><BR>
Password:<input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<input type="hidden" name="sublogin" value="1">
<br>
<input type="submit" value="Login"></td></tr>
</form>
<?php
}else{
$query = "SELECT id, title FROM blog_posts";
$result = @mysql_query($query);

if ($result) {
echo '<div align="center">
<table border="0">
<tr>
<td><b>ID</b></td>
<td><b>Title</b></td>
<td><b>Delete</b></td>
<td><b>Edit</b></td>
</tr>';

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<tr>
<td>'.$row['id'].'</td>
<td>'.$row['title'].'</td>
<td><a href="include/delete_news.php?id='.$row['id'].'">Delete</a></td>
<td><a href="include/edit_news.php?id='.$row['id'].'">Edit
</tr>';
}
} else {
echo 'Sorry, but we could not retrieve any blogroggoring records.';
}
echo '<a href="?s=addblog" title="addblog" id="addblog"><span>Add Blog</span></a>';
}
?>

 

That's for the bloggroggering section, that's how it would normally work. How would I change it to start using my link system. (I'm sorry if none of this is clear, i'm hopped up on cold medication and i'm insanely sick. :< )

Link to comment
https://forums.phpfreaks.com/topic/42059-more-variables-in-the-links-d/
Share on other sites

I'm not exactly sure if I understand what you're trying to do here, but it would really depend on your del_news.php file's code. The code you are showing us seems to just display the buttons for editing/deleting the entries, but none of the code to actually do the editing or processing of it. Maybe you can show us del_news.php, or maybe I'm just not understanding this well?

I'm not exactly sure if I understand what you're trying to do here, but it would really depend on your del_news.php file's code. The code you are showing us seems to just display the buttons for editing/deleting the entries, but none of the code to actually do the editing or processing of it. Maybe you can show us del_news.php, or maybe I'm just not understanding this well?

 

basically, all of my links are

 

http://localhost/?s=links

http://localhost/?s=downloads

etc

 

I normally the link to delete a post contains a variable.  I'm unsure on how to do that.  This is how it normally would be.

 

http://localhost/include/delete_news.php?id='.$row['id']

 

IE:

http://localhost/include/delete_news.php?id=1

http://localhost/include/delete_news.php?id=2

http://localhost/include/delete_news.php?id= *ETC*

 

Since I change all my links to "s?=NAME" it will not work correctly.  How do I adjust the lines:

 

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<tr>
<td>'.$row['id'].'</td>
<td>'.$row['title'].'</td>
<td><a href="include/delete_news.php?id='.$row['id'].'">Delete</a></td>
<td><a href="include/edit_news.php?id='.$row['id'].'">Edit
</tr>';

 

To acomidate how my links are done.  thanks, any help is appreciated.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.