chrules Posted October 15, 2010 Share Posted October 15, 2010 Hi there, I've been working on a way to create a new page file while adding it's path and name(alias) to a MySQL database... My problem is that some of the information, apparently, isn't being send :S... The form file <form name="pagecreate" method="POST" action="pagecreate.php"> Alias: <input type"text" name"pagealias" /> <input type="submit" value="submit"> </form> And the submit function <?php // connect to database include '../../include/databaseconnection.php'; // grab the variables from the form $pagealias = $_POST['pagealias']; // get the number for the page (choose max + 1, so that you don't have existing value) $query = "SELECT MAX(pagenumber) FROM Links"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $max = $row['MAX(pagenumber)']; $pagenumber = $max+1; // create the file $createFileName = "../../pages/page_".$pagenumber.".php"; $FileHandle = fopen($createFileName, 'w+') or die("can't create file"); fclose($FileHandle); // create filepath $filepath = "page_".$pagenumber; // insert the data into the database $query2 = "INSERT INTO Links VALUES('', '$pagealias', '$filepath', '$pagenumber')"; mysql_query($query2) or die(mysql_error()); // redirect to another page header("Location: ../../index.php"); ?> Argh!, forgot to say, that it is pagealias that isn't being send ^^... Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 15, 2010 Share Posted October 15, 2010 You left out the = in the field tag <input name"pagealias" . . . Quote Link to comment Share on other sites More sharing options...
chrules Posted October 15, 2010 Author Share Posted October 15, 2010 You left out the = in the field tag <input name"pagealias" . . . Oh, my, God... I guess i just couldn't see the forest for the trees ^^.. well, thx mate 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.