Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 10-18-2009, 10:03 AM   #1 (permalink)
Junior Member
 
Join Date: 10-10-09
Location: east coast
Posts: 9
iTrader: 0 / 0%
richlather is liked by many
mailing list php problem

Hi-

I am new with php and mysql and having a good bit of trouble setting up an email subscriber
form on a website I maintain. The site is hosted with godaddy and, after 2 days on the phone
with them I've come to the conclusion that while I'm not the brightest bulb on the tree, they
really don't want to be of much help.

I purchased a "website building for dummies" type book which contained the following code, meant by the author
as a "works across the board" kind of document. Unfortunately, it doesn't work in this case.

When I input information from the form I created it seems fine, but then when I check the database,
a new record has been created but the fields are empty.The database is simple in that only
three fields are required, the "ID", the subscriber's name, and the subscriber's email address.

Can anyone tell he either a) what is wrong with the php document below or b) does anyone
have a sample document that they know works with godaddy hosting that I might use?

Thanks in advance. here's the code that doesn't work:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<?php
$Name=$_POST['Name'];
$EMail=$_POST['EMail'];
$connection=mysql_connect ("databaseaddress",
"myusername", "mypassword") or die ('I cannot
connect to the database.');
mysql_select_db ("mydatabase",$connection) or die(
"Unable to select database");
$query = "INSERT INTO `mytable` (`ID`, `Name`,
`EMail`) VALUES ('', '$Name', '$EMail')";
mysql_query($query);
mysql_close();
?>
</body>
</html>

One last thing...when building the database I used the following field settings:
ID:
type-integer, legnth-4, collation-empty, attributes-unsigned, null-no, default-empty, extra-auto_increment, primary key
Name:
type-varchar, length-40, collation-UTF8_unicode_ci, attributes-empty, null-no, default-empty, extra-empty
EMail:
type-varchar, length-40, collation-UTF8_unicode_ci, attributes-empty, null-no, default-empty, extra-empty

When I created the database I used the default setting for the database type (MyISAM).

Thanks to anyone who can shed some light on this for me.
richlather is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-18-2009, 09:18 PM   #2 (permalink)
Contributing Member
 
Join Date: 10-13-09
Location: Singapore
Posts: 69
iTrader: 0 / 0%
Latest Blog:
None

socks is on the right pathsocks is on the right path
Lightbulb

Have you tried
Code:
mysql_query($query) or die(mysql_error());
? It may shed some light on your issue. The only other problem I can think of is that your form names aren't named accordingly, eg;
Code:
<form action="linktoyourscript.php" method="post"> <input type="text" name="Name" /> <input type="text name="EMail" /> <button type="submit">Submit</button> </form>
__________________
JaBlog. <3
9rg.net - URL Shortening. :)
socks is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-21-2009, 06:49 PM   #3 (permalink)
Junior Member
 
Join Date: 10-10-09
Location: east coast
Posts: 9
iTrader: 0 / 0%
richlather is liked by many
Thank You. It appears that you were right about the form names. That seems to have solved it. Thank You very much!!
richlather is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-22-2009, 07:35 PM   #4 (permalink)
v7n Mentor
 
abajan's Avatar
 
Join Date: 08-08-09
Location: Barbados
Posts: 119
iTrader: 0 / 0%
Latest Blog:
None

abajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really niceabajan is just really nice
richlather, I know your problem has been solved but should you ever need an alternative, here’s a sign-up form that might fit the bill. I haven’t tested it but it sure looks interesting.
__________________
If my posts offend thee, I’m just blowing my own horn!
abajan is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pHp mailing list problem, globalcashsite Web Design Lobby 5 08-07-2009 11:49 AM
JV Program for Mailing List Owners or Marketers Without a Mailing List. holdem8 Joint Ventures 0 05-09-2009 12:01 PM
Mailing List for MAC Stitchy626 Coding Forum 4 01-03-2006 04:29 PM
Mailing list Jonathan VanSchaack Web Design Lobby 9 07-11-2005 09:53 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:41 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.