artdezign

Passing Blank Values in a Form - API

Discussion created by artdezign on Dec 3, 2012
Latest reply on Dec 5, 2012 by Mike_Mitchell

Hi There,

 

I have a form that is meant to create a new entry for a blog post. But once it is executed it creates a new record with only blank values. Can anyone tell what is missing here?

 

Form Code:

 

 

<form action="newEntryResponse.php" method="POST" name="newEntry">

 

 

<h2>Title</h2>

<input name="title" type="text" id="title"><br />

<h2>Content</h2>

<textarea name="body" cols="50" rows="8"></textarea><br />

<input type="submit" name="submit" value="Submit Post"><br />

</form>

 

Respose PHP code:

 

<?php

require_once ('../config.php');

require_once ('functions.inc.php');

?>

 

 

<?php

$newPostCmd = $fm->newAddCommand('BlogPosts'); // initialize the database for Add Command

$newPostCmd->setField('title',POST('title')); // Create the new Title Field

$newPostCmd->setField('body',POST('body')); // Create the new Body Field ($fmCommance->setField('fieldName', $value);

$newPost=$newPostCmd->execute(); //execute the command

 

 

if(FileMaker::isError($newPost)) {

die('Database Error: '.$newPost->getMessage());

}

 

 

?>

<?php include('BlogHeader.php'); ?>

 

 

<main>

<paper>

<h1>Success</h1>

<p>Your Post was made Successfully, please go back to the <a href="index.php">Home Page</a></p>

</paper>

</main>

 

 

<?php include('BlogFooter.php'); ?>

 

I greatly appreciate any suggestions you have.

 

Thanks,

Outcomes