datto510 Posted December 31, 2015 Share Posted December 31, 2015 Hi, I have a form using post function Job No: <input type="text" name="jobno"><br and the next php file uses this code $objWriter->save("'jobno'.xlsx"); but its ignoring the variable thats being input Quote Link to comment Share on other sites More sharing options...
requinix Posted January 1, 2016 Share Posted January 1, 2016 Because it isn't using a variable in the first place. All you did was make a string that contains an apostrophe, the word "jobno", another apostrophe, a period, and "xslx". If you want a variable in there then put a variable in there. if (!isset($_POST["jobno"])) { // error: value missing } else if ($_POST["jobno"] == "") { // error: empty value } else if (!ctype_digit($_POST["jobno"])) { // replace with whatever validation you need // error: invalid jobno } else { $jobno = $_POST["jobno"]; } // ... $objWriter->save($jobno . ".xlsx"); Quote Link to comment 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.