Jump to content

[SOLVED] GET method help - Chigley's help?


ryeman98

Recommended Posts

Well I guess I'll just explain it again.

 

I have a page called article.php and it displays whichever article a user wants to view. The link to get to an article is:

 

Now I want to have a form within the article.php file which will only display when I go to:

 

I've attempted making it work but it was no good. This is the code for article.php:

<?php
include("config.php");

//All of this code is fine

if ((isset ($_GET['article_id']))) {

$id = $_GET['article_id'];

$query = mysql_query("SELECT * FROM news WHERE id = $id");
$result = mysql_fetch_array($query);
$getarticle = $result['id'];
$title = $result['title'];
$date = $result['date'];
$content = $result['content'];
echo "<p class=\"hide\">";
echo $getarticle;
echo "</p><h3>";
echo $title;
echo "</h3><p>";
echo $date;
echo "</p><p>";
echo $content;
echo "</p>";

}
?>

<?php

//This is the code that won't work

if ((isset ($_GET['action'] = ['new']))) {

$date = date("F j, Y");

echo "<form name=\"addarticle\" action=\"/article_submit.php\" method=\"post\">
Title: <input type=\"text\" name=\"title\" />
Date: $date
Content: <textarea name=\"content\" maxlength=\"10000\"></textarea>
<input type=\"submit\" name=\"submit\" value=\"Add Article\" />
</form>";

}
?>

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.