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
  #1 (permalink)  
Old 11-06-2009, 10:51 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Looking for some help with my form please

I have a simple form that I found from a tutorial but am now lost. Unfortunately I haven't learned forms yet.

My questions are: (based from the code below)

1. What do I add to my code to make the submit button, submit the info.
2. What do I add to my code to make my required fields, actually required upon submission?


HTML
Code:
<div id="stylized" class="myform"> <form id="form" name="form" method="post" action="index.html"> <label>Name&nbsp;*</label> <input type="text" name="name" id="name" /> <label>Email&nbsp;*</label> <input type="text" name="email" id="email" /> <label>Website (URL)&nbsp;*</label> <input type="text" name="website" id="website" /> <label>Phone Number</label> <input type="text" name="phone number" id="phone number" /> <button type="submit"><img src="images/submit.gif" /></button> </form> </div>
CSS
Code:
.myform{ width:245px; height: 340px; padding: 60px 12px 0px 12px; font-size:13px; color: #ffffff; } #stylized{ background: url(images/quote-request-2.gif) no-repeat; } #stylized label{ display:block; font-weight:bold; width:140px; text-align: left; margin-left: 10px; } #stylized input{ font-size:13px; padding:4px 2px; width:200px; margin:2px 0 10px 10px; } #stylized button{ background: none; border: none; margin-left:111px; width:109px; height: 30px; }
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #2 (permalink)  
Old 11-07-2009, 12:03 AM
codecs's Avatar
Contributing Member
 
Join Date: 11-03-08
Posts: 121
iTrader: 0 / 0%
codecs is on the right pathcodecs is on the right pathcodecs is on the right path
You need php script to send that form through mail or to your database. You can also use javascript to check for required fields. Do you use software for your coding?
__________________
Fashion Social Bookmark | Latest prada handbags
Latest Prada Handbags and Purses
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #3 (permalink)  
Old 11-07-2009, 12:49 AM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Shoot, unfortunately, I'm only familiar with html/css.

I use Notepad++ but have Kompozer installed to give it a shot.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #4 (permalink)  
Old 11-07-2009, 06:25 AM
Contributing Member
Latest Blog:
None

 
Join Date: 11-13-07
Location: London
Posts: 78
iTrader: 0 / 0%
urstop is liked by many
Check this link, it has a complete example with the code which you can use.

http://www.phpf1.com/tutorial/php-form.html
__________________
UK Freelance Web Developer
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #5 (permalink)  
Old 11-07-2009, 01:41 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Thanks for the helpful link.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #6 (permalink)  
Old 11-07-2009, 02:46 PM
ScriptMan's Avatar
Super Moderator
Latest Blog:
None

 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 2,109
iTrader: 3 / 100%
ScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest orderScriptMan is a web professional of the highest order
Quote:
action="index.html">
You name the file you are posting the data to in the action call. In this case as you posted above the data is being submitted to index.html.

You can check the input with javascript or validate it when it gets to the php based form.


Tell us what you want to do with the data and someone will offer some suggestions.
__________________
These forums are as good as the posts that you contribute to them.~~
ScriptMan
Webmaster Help Articles
Domains & Sites For Sale by Owner
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #7 (permalink)  
Old 11-07-2009, 02:54 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
I see, thanks.

I'm looking to just have the info emailed to me.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #8 (permalink)  
Old 11-08-2009, 08:59 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Foppa, were you able to get this all worked out and getting the data emailed to yourself?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #9 (permalink)  
Old 11-08-2009, 02:01 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Quote:
Originally Posted by Izzmo View Post
Foppa, were you able to get this all worked out and getting the data emailed to yourself?
Unfortunately, no. I think I'm just going to pay someone to do it.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #10 (permalink)  
Old 11-08-2009, 02:04 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
It's not that difficult, I'm sure you could find someone to do it fairly cheap, or for free.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #11 (permalink)  
Old 11-11-2009, 01:21 PM
megamoose's Avatar
v7n Mentor
 
Join Date: 06-04-06
Location: Northern Ireland
Posts: 506
iTrader: 2 / 100%
megamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to all
Send a message via ICQ to megamoose Send a message via MSN to megamoose Send a message via Yahoo to megamoose Send a message via Skype™ to megamoose
STEP 1:
Change:
Code:
<form id="form" name="form" method="post" action="index.html">
To:
Code:
<form id="form" name="form" method="post" action="submit.php">
STEP 2:
Change:
Code:
<input type="text" name="phone number" id="phone number" />
To:
Code:
<input type="text" name="phonenumber" id="phonenumber" />

STEP 3:
Create a new file on your server called submit.php

STEP 4:
In that file put the following:

Code:
<?php // Construct the message $message = "Name: ".$_POST["name"]; $message .= "\n"; $message = "From: ".$_POST["email"]; $message .= "\n"; $message = "Website: ".$_POST["website"]; $message .= "\n"; $message = "Phone Number: ".$_POST["phonenumber"]; // Actually send the email // YOUR EMAIL ADDRESS | SUBJECT | MESSAGE mail('myemail@domain.com', "WEB FORM: ".$_POST["name"], $message); // Navigate to the success.html page header("location: success.html"); ?>
STEP 5:
Create a success.html file which will contain a thank you or success page of your choice.

I haven't tested this, but if you want some help with it just ask.
__________________
Message me for PHP | HTML | CSS | JAVASCRIPT | .NET | MySQL help and support

Last edited by megamoose; 11-11-2009 at 01:24 PM. Reason: added commenting
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #12 (permalink)  
Old 11-13-2009, 07:02 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Wow, thanks a lot megamoose.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #13 (permalink)  
Old 11-22-2009, 04:16 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
I finally got around to testing the form and it does work, it just doesn't send all the information.

In the email I receive, I get the person's name in the email subject line and the only other info that I get is the phone number.

Any way to correct this? I made the changes you suggested and didn't change anything else.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #14 (permalink)  
Old 11-22-2009, 08:52 PM
Smith.John's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 11-06-09
Posts: 64
iTrader: 0 / 0%
Smith.John is liked by many
Do you mean the front page disply problems?
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #15 (permalink)  
Old 11-22-2009, 10:24 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Quote:
Originally Posted by Smith.John View Post
Do you mean the front page disply problems?
I'm not sure what you mean. The problems are with the information that the script is emailing me once the form is filled out.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #16 (permalink)  
Old 11-22-2009, 10:30 PM
htmlbasictutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 5,664
iTrader: 2 / 100%
htmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest orderhtmlbasictutor is a web professional of the highest order
Quote:
Originally Posted by Foppa View Post
I finally got around to testing the form and it does work, it just doesn't send all the information.

In the email I receive, I get the person's name in the email subject line and the only other info that I get is the phone number.

Any way to correct this? I made the changes you suggested and didn't change anything else.
You have to add more variables for the information collected on the form and add them to your message variable.
__________________

HTML Basic Tutor - Learn to code your web pages/blogs
Basic Computer Information - Computer Basics for website owners


Trouble getting indexed? Maybe it's something technical - Pm me.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #17 (permalink)  
Old 11-23-2009, 04:49 AM
megamoose's Avatar
v7n Mentor
 
Join Date: 06-04-06
Location: Northern Ireland
Posts: 506
iTrader: 2 / 100%
megamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to allmegamoose is a name known to all
Send a message via ICQ to megamoose Send a message via MSN to megamoose Send a message via Yahoo to megamoose Send a message via Skype™ to megamoose
Sorry the submit.php should be as follows

Code:
<?php // Construct the message $message = ""; $message .= "Name: ".$_POST["name"]; $message .= "\n"; $message .= "From: ".$_POST["email"]; $message .= "\n"; $message .= "Website: ".$_POST["website"]; $message .= "\n"; $message .= "Phone Number: ".$_POST["phonenumber"]; // Actually send the email // YOUR EMAIL ADDRESS | SUBJECT | MESSAGE mail('myemail@domain.com', "WEB FORM: ".$_POST["name"], $message); // Navigate to the success.html page header("location: success.html"); ?>
Note how the $message now has a .= instead of = on each line. This was a mistake on my coding, as I didn't test it I didn't find the bug until you mentioned it. The .= appends to the variable as = resets it.
__________________
Message me for PHP | HTML | CSS | JAVASCRIPT | .NET | MySQL help and support
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #18 (permalink)  
Old 11-23-2009, 01:21 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
Perfect, thanks megamoose, it's working great now. Thanks for the explanation too.

How can I make my required fields, actually required?
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #19 (permalink)  
Old 11-28-2009, 11:59 PM
Contributing Member
Latest Blog:
None

 
Join Date: 03-29-09
Posts: 60
iTrader: 0 / 0%
Foppa is liked by many
I added another form to my contact page, but can't get the text boxes lined up. Can someone help me with this?

This is how it looks:


Code:
<div id="form-contact-page" class="contact-form"> <form action="contact.php" method="post"> <label for="Name:">Name:</label> <input id="Name:" name="Name:" type="text" /> <label for="Email:">Email:</label> <input id="Email:" name="Email:" type="text" /> <label for="Website(URL):">Website (URL):</label> <input id="Website(URL):" name="Website(URL):" type="text" /> <label for="PhoneNumber:">Phone Number:</label> <input id="PhoneNumber:" name="PhoneNumber:" type="text" /> <label for="Question/Comment:">Question / Comment:</label> <textarea id="Question/Comment:" name="Question/Comment:"></textarea> <button type="submit"><img src="images/submit2.gif" /></button> </form> </div>
Code:
.contact-form{ width:550px; font-size:13px; color: #165788; padding:12px; } #form-contact-page label{ display:block; font-weight:bold; float:left; clear: left; } #form-contact-page input{ font-size:13px; padding:4px 2px; width:200px; margin:2px 0 10px 59px; border: 1px solid #165788; float: left; } #form-contact-page textarea{ font-size:13px; padding:4px 2px; width:300px; height: 85px; margin:2px 0 10px 12px; border: 1px solid #165788; font-family: Verdana, Arial, Helvetica, sans-serif; } #form-contact-page button{ background: none; border: none; margin-left:185px; margin-top: 12px; }
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #20 (permalink)  
Old 11-29-2009, 01:59 AM
socks's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-09
Location: Singapore
Posts: 238
iTrader: 0 / 0%
socks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nicesocks is just really nice
Try using this; (I changed your css a little)
Code:
.contact-form { width:550px; font-size:13px; color: #165788; padding:12px; } #form-contact-page label { font-weight:bold; float:left; width: 150px; padding: 5px; clear: left; } #form-contact-page input { font-size:13px; padding:4px 2px; width:200px; margin:2px 0 10px; border: 1px solid #165788; float: left; } #form-contact-page textarea { font-size:13px; padding:4px 2px; width:300px; height: 85px; margin:2px 0 10px; border: 1px solid #165788; font-family: Verdana, Arial, Helvetica, sans-serif; } #form-contact-page button { background: none; border: none; margin-left:185px; margin-top: 12px; }
Code:
<form action="contact.php" method="post"> <label for="Name:">Name:</label> <input id="Name:" name="Name:" type="text" /> <label for="Email:">Email:</label> <input id="Email:" name="Email:" type="text" /> <label for="Website(URL):">Website (URL):</label> <input id="Website(URL):" name="Website(URL):" type="text" /> <label for="PhoneNumber:">Phone Number:</label> <input id="PhoneNumber:" name="PhoneNumber:" type="text" /> <label for="Question/Comment:">Question / Comment:</label> <textarea id="Question/Comment:" name="Question/Comment:"></textarea> <button type="submit"><img src="images/submit2.gif" /></button> </form>
Attached Thumbnails
Looking for some help with my form please-v7n.png  
__________________
XignaLabs.com :)
If you are going to have a web design company, please make sure you can actually design your own site.
Digg this Post!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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with php form amkha69 Coding Forum 2 07-08-2009 06:27 AM
Need help please with a form alifar Web Design Lobby 12 09-14-2008 06:34 AM
Contact form please help to create a contact form jennypretty Coding Forum 2 07-03-2008 07:49 AM
Can't show non-modal form when modal form is displayed sypond Coding Forum 3 03-23-2007 08:31 AM


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


All times are GMT -7. The time now is 10:45 AM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


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