View Full Version : A long-winded plea...

11-07-2007, 03:16 PM
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.

<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" />

11-07-2007, 03:29 PM
wheres the php code?

11-07-2007, 03:35 PM
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.

$firstname = $_REQUEST[‘firstname’];
$lastname = $REQUEST[‘lastname’];
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "myname@example.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.example.com/thankyou.html" );