Jump to content

Form apparently not sending?


chrules

Recommended Posts

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 ^^...

Link to comment
https://forums.phpfreaks.com/topic/215959-form-apparently-not-sending/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.