simple input form giving error on insert.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

simple input form giving error on insert.

Post 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>
 
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: simple input form giving error on insert.

Post 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.
Post Reply