PHP form with html?

D

design2

Guest
ive done a tested php form , as a basic intro to php, still on the first few pages..but i want to edit the text color and other properties.

my form page is fine because its done in html, but the feedback page where it has the php response text is default text. I dont know where to put
the properties.

my code is:

<?php // Script 3.4 - handle_form.php

// This page recieves the data from feedback.html

// It will recieve: title, name, email, response, comments and submit.

print " Thank You " . $_POST['title'] . $_POST['name'] . " for your comments. <br />";
print "Your " . $_POST['response'] . " response stated: <p>" . $_POST['comments'];
?>
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
You can enter HTML underneath the PHP you've written. So just take out the print "" lines, close the php and make your html document from there. When you want to use the form data in the page (like to print their name) just open a php tag and put what you like. There are lots of ways of doing it

eg.

<?php

mail the data

?>

<html> etc... <body>
<?php print "Thanks " . $POST['name]; ?>

[or:]
Thanks <?php echo $POST['name]; ?>
</body>
</html>
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Or my favorite:

<?php

mail the data

?>

<html> etc... <body>
<?='Thanks '.$POST['name]?>

[or:]
Thanks <?=$POST['name]?>
</body>
</html>


Which cuts back on the code a bit :)
 
OP
D

design2

Guest
cool thanks guys, still learning..
god it took me awhile to get started until i learned my register_globals was off and the tutorial i was following was old and all there $examples i had to write as {$_POST['example']} . php is abit tricky to learn. i mean i aint even into databases yet.

Design2
 
OP
D

design2

Guest
Hey i made a small form and have made the php,
and its responding, like it gives me the echo commands,
but its not sending emails, what have i done wrong?
Please Help, Thanks

<?php
$subject = "Ebesign Comment" ;
$from = $_POST["form_email"] . "\n";
$name = $_POST['form_name'] . "\n";

$to = "[email protected]";

$message = $_POST['form_message'] . "\n";
mail($subject, $from, $name, $to, $message);
echo "To: " . $to . "<br />";
echo "Subject: " . $subject . "<br />";
echo "Message: " . $message . "<br />";
echo "From: " . $name . "<br />";
?>
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
PHP.net is your best friend! :)

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])

<?php
mail("[email protected]", "My Subject", "Line 1\nLine 2\nLine 3");
?>

<?php
mail("[email protected]", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"X-Mailer: PHP/" . phpversion());
?>


So in other words:

$subject = "Ebesign Comment" ;
$from = $_POST["form_email"];
$name = $_POST['form_name'];
$to = "[email protected]";

$headers = "From: $from\r\n" . "Reply-To: $from\r\n" . "X-Mailer: PHP/" . phpversion());

mail ($to, $subject, $message, $headers)


Cheers!
 
OP
D

design2

Guest
:)

hey much appreciation Murlyn, that worked. but i foundd my problem i forgot a ; dont u hate that? so i got my form running on my server, but my computer has to be on and apache running for the php to work yeah, so my new question is do you know any free php hosting place?
Oh and Murlyn, have u done a php? if so, whats the url, id like to see what you can do..

Design2
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Ok well.. don't laugh at my site because I just don't have time to work on it, but if you go to http://www.baskettcase.com you'll see a list of some of the stuff that I have done. I can't show you the administration for then though since they are my clients and I can't give certain business secrets away :) But most of those urls' have a really nice backend on them. the HawaiiHealthGuide one, is only one file per page, for 6 different domains.. which is pretty smooth I thought :)

Anyways have fun!
 
OP
D

design2

Guest
Murlyn: you must be a good programmer/ coder.

hey i found a free php host, no banners or anything, the server is a little slow but thats ok , the url is http://www.siriusdns.net/ setup Demo account. don't know how long for though.. i got mine at w.ebesign.siriusdns.net (outdated link removed) and the php works through their servers so it doesn't depend on running your own server and keeping it online.
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Well it is what I do for a living, so hopefully I am pretty decent at it :) Good luck with all of that!
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
OP
D

design2

Guest
what why? so all the threads, eva posted just stick around in the database and waste space? well thats stupid. sort it out mac-forums.com

Design2
 
Joined
Mar 9, 2004
Messages
2,860
Reaction score
21
Points
38
Location
Miami FL
Your Mac's Specs
G4 1Ghz OS X 10.4.7
This is very interesting thread :) Design2: The mods can close or merge threads as needed, no worries! :D
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
design2, if we close threads they're still in the database. It'd just appear as normal except nobody would be able to post in them.

If, on the other hand you're suggesting we delete threads to get them out of the database, what happens when somebody has a similar question to yours? Should we have to go through the whole thing again? Surely it would be a better idea to keep old threads around. And we're not exactly running out of space...
 
OP
D

design2

Guest
ok i understand that but still if nobody has posted something in the thread for like a month and it has less than i dont know 20 views and the guy who started the thread to ask a question got the solution in the first reply and wants to close it, you should do it. and if u have so much web space how about offering free web space or email for members? :)

Design2
 
OP
D

design2

Guest
oh as a topic change and all, you know how 'hits' are the amound of time the page is viewed regardless of whether its the same person viewing the page or the page being refreshed, is there an easy way using cookies to setup a counter that only counts each ip / host once, cos i would like to add something like this to my site as an invisible code and view it to see how many different people see it. thanks

Design2
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
Granted, it might be useful for a member to be able to close an old thread in no more need of discussion - but we can't set it so members can close threads like that and stop them from closing threads that may be still useful. Closing only prevents users from posting, and if they're already not posting, there's no reason to stop them from posting. We'd have to leave it to the moderators - and that'd be a waste of time, having us go through every old thread and deciding whether to close it or not. I definitely have more productive things I could be doing, and I'm sure the other moderators do too :)

As for the counter thing, yes it's very possible, and isn't too hard. Start a new topic though. Not only does it help users find topics they want, but it avoids people getting frustrated when they view a thread expecting to see one thing and see another.
 
OP
D

design2

Guest
muso i started the new thread, and u know the answer so can you help, if you want post in the other thread. :) cheers

Design2
 
OP
D

design2

Guest
(stretches) im going into mySQL, i repeat "im going in"
it aint confusin is it? using PHP and mySQL? for example im reading the tutorial to make a simple blog where people add there comments and it generates a list of blogs submitted using the SELECT command. well here goes..
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top