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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.