swamp Posted August 18, 2008 Share Posted August 18, 2008 Hi, I've got a form - one of the fields is called pagename: <input type="text" name="pagename"> This then gets added to a database: $add = mysql_query("INSERT INTO db ( content, title, author, pagename, img, post_date) VALUES ( How can I add .php to the end of the pagename field? For example if I submitted mypage into the pagename field it would get added to the database as mypage.php ? Help much appreciated, Cheers Link to comment https://forums.phpfreaks.com/topic/120161-adding-extension-to-form-field/ Share on other sites More sharing options...
JasonLewis Posted August 18, 2008 Share Posted August 18, 2008 $pagename = $_POST['pagename']; $pagename .= ".php"; //add the .php extension Or on one line: $pagename = $_POST['pagename'] . ".php"; //add the .php extension Link to comment https://forums.phpfreaks.com/topic/120161-adding-extension-to-form-field/#findComment-619051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.