Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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