Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-07-2007, 02:16 PM   PM User | #1
Michelle80
New to the CF scene

 
Join Date: Nov 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Michelle80 is an unknown quantity at this point
A long-winded plea...

I am a little embarrassed about this but here goes. I am trying to learn html and php at the same time so I can start my own new business. I have watched many tutorials and read a few books. I think I am trying to do something pretty basic, but the problem is I have a learning disability which makes things harder for me to absorb information than the average person no matter how hard I try. I think this is happening to me with html and php because for some reason it’s very hard for me to learn. So I hope someone with a kind heart is willing to help me. But if I am asking too much, no worries, I understand if you don’t have the time or inclination. You’re time is very important to you, I know that for sure!

Here’s the deal. I am trying to make a form with required fields. When people enter their information into the form, I would like their form data to get emailed to me while simultaneously having two of the field’s form data (the person’s first and last name) to get transferred to another page in my site. I think I am supposed to do to this with php sessions but I can’t figure out how.

Complicating matters is that my site host seems to prevent PHP from sending email messages when the "From:" header is from someone other than me or who doesn’t have the same @domain name as me. Obviously a user filling out the form is not going to have the same domain as me, so the only workaround I can think of is instead of putting the sender's (user’s) email address in the "From" field, put it in the message part instead and then put my own email address in the "From" field. But I can’t figure out how! That’s the first problem I’m having!

Second, I can’t figure out how to make all the form field required fields.

And lastly, I can’t figure out how to make a session or carry over the person’s first and last name to the next page. I think I did a pretty good job of making the form, but that’s all I have been able to do. If someone can help me with the remaining parts I would be so appreciative. But again, I understand if you don’t have the time or you are too busy to help.

Here's what i have so far. It's only a form, and like I said I I don’t know how to:
1. Make the fields required,
2. Put the sender's email address in the message part and mine in the "From" part so the form data gets emailed to me.
3. How to transfer the user’s first and last names into another page.
4. How to make sure they enter a valid email address
5. How to make sure they enter all the fields

All the best to everyone and I hope you have a happy holiday season!

Michelle P.

Code:
<form method="post" action="">
First Name: <input type=”text name = “firstname”><br />
Last Name: <input type=”text name = “lastname”><br />
Email: <input name="email" type="text" /><br />
Travel Dates: <input type = “text” name = traveldates”> <br />
Islands you’re visiting: 
<input type="checkbox" name="Maui" value="Maui" />
<br />
<input type="checkbox" name="Oahu" value="Oahu" />
<br />
<input type="checkbox" name="Big Island" value="Big Island" />
<input type="checkbox" name="Kauai" value="Kauai" />
<br />
<input type="checkbox" name="vehicle" value="Molokai" />
<input type="checkbox" name="vehicle" value="Lanai" />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
Michelle80 is offline   Reply With Quote
Old 11-07-2007, 02:29 PM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
wheres the php code?
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Old 11-07-2007, 02:35 PM   PM User | #3
Michelle80
New to the CF scene

 
Join Date: Nov 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Michelle80 is an unknown quantity at this point
Quote:
Originally Posted by shyam View Post
wheres the php code?
Sorry here it is. It doesn't work and I don't know what to do! I have tried over and over but have sort of given up. Thank you.
Code:
<?
$firstname = $_REQUEST[‘firstname’];
$lastname = $REQUEST[‘lastname’];
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$traveldates=$_REQUEST[‘traveldates’];
$maui=$_REQUEST[‘Maui’]’
mail( "myname@example.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.example.com/thankyou.html" );
?>
Michelle80 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 09:37 AM.


Advertisement
Log in to turn off these ads.