Jump to content

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>";

}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.