Page 1 of 1

simple input form giving error on insert.

Posted: Sat Feb 20, 2010 11:56 am
by egturnkey
Hello friends,

i just trying to me a simple cms where

index.php ( output )
add.php ( input ) page title/page content ( only one form )

when i do add page title/page content it gives error

atal error: Call to undefined function executeupdate() on line 6

here is the code ( it shows error here )

Code: Select all

 
<?
$pagetitle=$_POST['pagetitle'];
$pagehtml=$_POST['pagehtml'];
 
$sql= "insert into pages set pagetitle='$pagetitle', pagehtml='$pagehtml'";
executeupdate($sql);
 
$msg= "New Page Added";
session_register('msg');
header("Location: addpage_frm.php ");
exit;
?>
 


and html code ( where config.inc.php ) connect the dp

Code: Select all

 
<? include "../config.inc.php"; ?>
<table>
<form action="addpage.php" method="post">
 
<tr>
<td width="41%" height="36" align="right">Page Title</td>
<td width="59%"><input name="pagetitle" type="text" id="pagetitle"></td>
</tr>
 
 
<tr>
<td><div align="right">HTML Content</div></td>
<td><textarea name="pagehtml" rows="10" cols="30"></textarea></td>
</tr>
 
 
 
<tr>
<td width="41%"></td>
<td width="59%"><font color="#FFFFFF">
<input type="submit" name="Submit" value="Add Now">
</font></strong></font></td>
</tr>
</form>
</table>
 

Re: simple input form giving error on insert.

Posted: Sat Feb 20, 2010 12:19 pm
by jraede
First of all, your INSERT syntax is wrong. You used the syntax for UPDATE. Check here for the correct syntax.

Second, your issue is there is no function called executeupdate(). Assuming you're using MySQL, you just have to use mysql_query($sql) instead of executeupdate($sql).

EDIT

Also, you should use <?php instead of <? to start your scripts, it may work for you the other way, but technically it's not correct and may cause you errors further down the road.