Jump to content

Problems with database


str0kes

Recommended Posts

Hello guys, I have problem with the script i was coding. This is a simple news script. I am not able to add information to the database. I don't know what Im doing wrong. Here is my php code:

 

<?php
if (isset($_POST['submit'])) { 
$title=$_POST['title'];
$small_text =$_POST['small_text'];
$full_text=$_POST['full_text'];
include("connectmysql.php");
mysql_query("insert into main (id,title,small_text,full_text) values('$id','$title','$small_text','$full_text')");
}
?>

 

here is html:

 

<FORM  name="forma2"  action="?" method="post" enctype="multipart/form-data">
<TABLE>
<TR>
	<TD>Title</TD>
	<TD> 
<input type="text"  size="70"   name="title">

</TD>
</TR>
<TR>
	<TD>small text</TD>
	<TD>
<input type="text"  size="80"   name="small_text">
</TD>
</TR>
<TR>
	<TD>full text</TD>
	<TD>

<textarea cols="60" rows="12"   name="full_text"></textarea>

</TD>
</TR>
    <TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture"></TD>
</TR>
<TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture2"></TD>
</TR>
<TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture3"></TD>
</TR>
<TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture4"></TD>
</TR>
<TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture5"></TD>
</TR>
<TR>
	<TD>picture</TD>
	<TD><input type="file" name="picture6"></TD>
</TR>
   	<TR>
	<TD></TD>
	<TD><input type="submit"  value="submit"></TD>
</TR>
</TABLE> </form>

 

I tried to use $id=Time("U"); and then i used $id=$_POST[id] but didn't get it working. Any help please?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/266406-problems-with-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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