visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: Photo Orderform processed by php


By: MAGLAN U.S.A.  Date: 09/04/2003 00:00:00  English  Points: 75 Status: Answered
Quality : Excellent
Hi ppl,

New to PhP but aware of its capabilities!
Got the following problem, i've got a formpage with 139 photos on it. Each photo has a checkbox underneath it defined as name="photo_1" with value="thailand_001" etc. I want to give visitors the possibility or option to check/mark photos, supply their personal info and than send it to me.
Afterwards i will process their orderform and burn the selected images to a cd.
If i look at the orderform itself it contains a lot of code(!) incl. <input type="hidden" name="photo_1" value="thailand_001">.
My question how can i set up a 'simple' PhP script that will process this orderform and send it to me by mail (of course)? Afterwards displaying a confirmation of the order being processed.
Any suggestions? Can anyone help me out?
By: VGR Date: 09/04/2003 17:58:00 English  Type : Comment
yes. could I see the "ortder form" and know clearly enough what you expect ?

For example the FORM does already exist, so it must lead somewhere when the user push the "submit" button. Where ? Do you want to modify the "receving" script ? Is there one ? Is it, on the other hand, the same script as the one generating the "order form" ?

That kind of thing.
By: MAGLAN Date: 09/04/2003 18:35:00 English  Type : Comment
Hi VGR,

Of course, you can look at the code at <A HREF="http://www.imtf.nl/test/orderform.htm">www.imtf.nl/test/orderform.htm</a>
Pretty new to setting up orderforms (of this magnitude) and i bet there is an easier way except i don't know it...
Basically it shows you what i mean (i hope)
By: MAGLAN Date: 09/04/2003 18:41:00 English  Type : Comment
VGR, btw forgot to mention that this is just the partial form of course since i still need to add 'personal info fields at the bottom of the form...!

Thnx
By: VGR Date: 09/04/2003 19:08:00 English  Type : Comment
so let's be clear : you have a form, but not yet any processing on the values entered in that FORM ? Am I right ?
By: MAGLAN Date: 09/04/2003 19:16:00 English  Type : Comment
Correct, i've just upped the form again with the necessary field at the bottom but Yes u are quiet right.
By: VGR Date: 09/04/2003 19:34:00 English  Type : Comment
ok, I'm looking at it right now
By: VGR Date: 09/04/2003 19:37:00 English  Type : Comment
not good.

First get rid of the hidden fields at the bottom.

the <input type="checkbox" name="photo_58" value="thailand_058"> are enough to get the required information, althought I would have names all the checkboxes the same in an array (to facilitate retrieval)
By: VGR Date: 09/04/2003 19:39:00 English  Type : Comment
also clear one target= from this :
<form name="Orderform" target="content" method="post" action="orderproces.php" target="content">
By: VGR Date: 09/04/2003 19:42:00 English  Type : Comment
are you sure you want those data by email ?

you've two solutions : the simple and the dirty :D

the simple : set <form name="Orderform" method="post" action="mailto:youradresse" ENCTYPE="plain/text">

the dirty : a PHP page gathering only the required information and sending you the mail.
I'll do the dirty one while you think about it 8-)
By: VGR Date: 09/04/2003 19:58:00 English  Type : Comment
I didn't test this "live", but it should do the job :

<?php
//
// orderproces.php
//

// construct order
//1 get POST variables in a loop
//2 build email
$body='New Order\r\nSelected photographs :\r\n';
foreach ($_POST as $field => $value) {
if ($value<>"") $body.="$value\r\n";
} // foreach
$body.='\r\n\r\nYour robot.';
//3 send it
mail('youradress@ispo.com','a new order',$body,"From: contact@$SERVER_NAME\r\nReply-To: contact@$SERVER_NAME\r\nX-Mailer: PHP/" . phpversion());
//4 display message
echo "be patient, your order is being processed.";
?>

By: MAGLAN Date: 09/04/2003 20:17:00 English  Type : Comment
Right..! 1st of all VGR, much appreciated :)

Gotta work this out but i think i'll go for the dirty one :P I mean asking 4 yer help means i need to learn something here...!

(5min. later)

VGR what can i say?! I tested it and it works!! :P

Thank you, this is great, much obliged!!
By: VGR Date: 09/04/2003 20:25:00 English  Type : Comment
yeah man! I'm getting soooo oooold that I can even make "programs" that work without compiling nor testing them. Man, oh man!

I'm amazed it worked :D

beware that mail() may be deactivated at your ISP or hosting facility, but I've counter-measures, of course :D
By: MAGLAN Date: 09/04/2003 20:30:00 English  Type : Comment
1 Final Q. how are the points transferred 2 u?

Shouldn't i accept yer comment (solution) in some way? :)

of course as a token of appreciation
By: VGR Date: 09/04/2003 20:38:00 English  Type : Answer
exactly. "Accept" a comment is the way to go.

time for me to go to sleep now 8-)

Do register to be able to answer

EContact
browser fav
page generated in 363.909010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page