Jump to content


php/mysql help


  • Please log in to reply
No replies to this topic

#1 _*Evan_*

_*Evan_*
  • Guests

Posted 19 September 2004 - 12:56 PM

for some reason this script, which will insert a row into a mysql db doesnt work! here is my script:

function add(){
	if($_POST['submit'])
	{ 
	$ptitle = $_POST['title'];
	$pdescription = $_POST['description'];
	$picon = $_POST['icon'];
	$ptut = $_POST['tut'];
	$pid = $_POST['id'];
	$pdate = date("d/n/y");

	dbconnect();
	$query = "INSERT INTO `tuts` ( `title` , `descript` , `ico` , `tut` , `date` , `id` ) VALUES ('$ptitle', '$pdescription', '$picon', '$ptut', '$pdate', '$pid')";	
	mysql_query($query) or die("Unable To Add Tutorial!");
	}else{
	nav();
?><head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<form name="form1" method="post" action="admin.php?act=add">
  <table width="100%" border="0" cellspacing="3" cellpadding="1" class="add-tb">
    <tr> 
      <td colspan="3" class="add-top--tb"><h1>Add A Tutorial:</h1></td>
    </tr>
    <tr> 
      <td width="22%">&nbsp;</td>
      <td width="67%">&nbsp;</td>
      <td width="11%">&nbsp;</td>
    </tr>
    <tr> 
      <td>Title:</td>
      <td> <input name="title" type="text" size="90"> </td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td height="25">Description:</td>
      <td><input name="description" type="text" size="90"></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td>Icon URL:</td>
      <td><input name="icon" type="text" size="90"></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td>ID:</td>
      <td><input name="id" type="text" size="90"></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td valign="top">Tutorial:</td>
      <td><textarea name="tut" cols="80" rows="20"></textarea></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td><input type="submit" name="Submit" value="Submit"></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
<?php
}
?>

when i press submit, it just resets the form and nothing happens... hope you can help!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users