Jump to content

Complete Noob looking for help with PHP subscribe form


thestudio

Recommended Posts

hi guys i am noob to scripting and PHP,

i have managed to create my database in phpmyadmin and setup acess on dreamweaver

but i would like to connect my form to the database so it can store information

the table is structured as follows

 

ID (i would like for each visitor to have their Id generated)

Name

Email

 

the form with have two input fields

Name and email

 

now comes the important bit;

how can i set-up the form to take the information and store it on my database and then give a generated unique ID to different users

many thanks

thestudio

Link to comment
Share on other sites

You probably wont find a lot of help here as this forum is for helping people who are having problems with code they are writing, not for teaching someone how to write code.

 

There are plenty of beginners php tutorials on the net, googling for some of them is probably your best bet.

Link to comment
Share on other sites

well, if ur using phpmyadmin, just click on SQL and insert the followin code

 

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(25) NOT NULL default '',
`time` int(11) NOT NULL default '0',
`ip` varchar(20) NOT NULL default '',
PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;

 

`id` int(11) NOT NULL auto_increment

 

this will automatically create an unique ID

 

signup.php

 

<?php

if(isset($_POST['submit']))
{
mysql_query("INSERT INTO `users` (`username`, `time`, `ip`) VALUES ('$_POST[username]', '".time()."', '".$_SERVER['REMOTE_ADDR']."')");
}

echo '<table width="100%" cellspacing="0" cellpadding="5" border="0">
<form method="post" action="/signup.php"><input type="hidden" name="submit" value="1" />
<tr><td>username:</td><td><input type="text" name="username" size="30" /></td></tr>
<tr><td> </td><td><input type="submit" value="Signup" /></td></tr>
</form>
</table>';

?>

 

i hope this helps..

Link to comment
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.