ryeman98 Posted May 13, 2007 Share Posted May 13, 2007 I don't normally do this but I'm in a rush...Chigley, I sent you a message containing my problem and I forgot to save it so...yeah... Sorry if you'd consider this spamming but I still need help, technically. Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/ Share on other sites More sharing options...
ryeman98 Posted May 13, 2007 Author Share Posted May 13, 2007 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: http://somesite.com/article.php?article_id=# Now I want to have a form within the article.php file which will only display when I go to: http://somesite.com/article.php?action=new 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/#findComment-252325 Share on other sites More sharing options...
makka Posted May 13, 2007 Share Posted May 13, 2007 you could use a function function form() { echo "your form in here"; } then just add this at the top if ($id == new){ form(); } or instead of $id you could use $_GET['action'] Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/#findComment-252329 Share on other sites More sharing options...
chigley Posted May 13, 2007 Share Posted May 13, 2007 I have to go now ryeman98, I'll do it tomorrow Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/#findComment-252331 Share on other sites More sharing options...
ryeman98 Posted May 13, 2007 Author Share Posted May 13, 2007 Thank you so much, it works! Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/#findComment-252336 Share on other sites More sharing options...
makka Posted May 13, 2007 Share Posted May 13, 2007 no problem o Link to comment https://forums.phpfreaks.com/topic/51229-solved-get-method-help-chigleys-help/#findComment-252369 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.