pouncer Posted April 9, 2009 Share Posted April 9, 2009 if (isset($_POST['update'])) { $rss_id = $_POST['rss_id']; $link = $_POST["txtRSS_" . $rss_id]; updateLink($rss_table, $rss_id, $link); } elseif (isset($_POST['delete'])) { $rss_id = $_POST['rss_id']; deleteLink($rss_table, $rss_id); } elseif (isset($_POST['view_rss'])) { $rss_id = $_POST['rss_id']; $link = $_POST["txtRSS_" . $rss_id]; viewRSS($link); } It's just if statements, but the contents of some of them are the same like the $rss_id variables. Quote Link to comment https://forums.phpfreaks.com/topic/153335-any-way-to-cut-this-code-down/ Share on other sites More sharing options...
Zhadus Posted April 9, 2009 Share Posted April 9, 2009 I'm sure we could find SOMETHING to cut down, but would need more code. What you have that doesn't give enough information for us to determine if something can be removed or adjusted etc. Post the form where the $_POST values are coming from, and additionally any other code on the page of those if/else statements. Quote Link to comment https://forums.phpfreaks.com/topic/153335-any-way-to-cut-this-code-down/#findComment-805583 Share on other sites More sharing options...
pouncer Posted April 9, 2009 Author Share Posted April 9, 2009 The html form is built dynamically. <form method ='post' action='index.php' name='rss_record'> <input name='txtRSS_15' type='text' id='txtRSS' size='70' value='http://slashdot.org/rss/slashdot.rss'/> <input name='update' type='submit' value='Update'/> <input name='delete' type='submit' value='Delete'/> <input name='view_rss' type='submit' value='View'/> <input type='hidden' name='rss_id' value='15'> </form> Quote Link to comment https://forums.phpfreaks.com/topic/153335-any-way-to-cut-this-code-down/#findComment-805674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.