Page 1 of 2

Email order Form

Posted: Mon Aug 25, 2014 4:22 am
by donny
hello

i want to be able to email a customer a order form through email and have them send it back via email

i then want to have something where i copy and past the email form onto a form on my page and the php will separate what their input is and put them all into variables so i can store them on my db .

example

name: %NAME% YOUR NAME HERE %NAME%
address %ADDRESS% YOUR ADDRESS HERE %ADDRESS%
zip %ZIP% ZIP CODE HERE %ZIP%
state %STATE% STATE HERE %STATE%

i basically want to send them something like that and then copy and paste their filled out form and have my code put whatever they put in between the fields will be separated and put into a variable

for example
i copy and paste this into my form

name: %NAME% robert %NAME%
address %ADDRESS% 55 sesame street %ADDRESS%
zip %ZIP% 90210 %ZIP%
state %STATE% florida %STATE%


form turns it into this

Code: Select all

<?
$name = robert;
$address = 55 sesame street;
$zip = 90210;
state = florida;
?>
the whole % thing is just an example of something that can identify between marks, idk just my imagination..

can somebody help me with something like this please?

Re: Email order Form

Posted: Mon Aug 25, 2014 5:45 am
by Celauran
Save that block as a template and use str_replace on it.

Re: Email order Form

Posted: Mon Aug 25, 2014 12:37 pm
by donny
can you show me an example for 1 field please

Re: Email order Form

Posted: Mon Aug 25, 2014 12:55 pm
by Celauran
Something like

Code: Select all

$template = str_replace('%USERNAME%', $user->name, $template);
Where $template contains the email template you've read in from a file or the DB.

Re: Email order Form

Posted: Mon Aug 25, 2014 1:14 pm
by donny
how can i do other fields ? also will i need to enclose it in %USERNAME% ? i don't get how this would work using my template

i will send them this in a email

name: %NAME% YOUR NAME HERE %NAME%
address %ADDRESS% YOUR ADDRESS HERE %ADDRESS%



they will send this back

name: %NAME% ROBERT JONES %NAME%
address %ADDRESS% 123 SESAME STREET %ADDRESS%

i want to make it into variables like this

$name = "Robert Jones";
$address = "123 Sesame Street";

Re: Email order Form

Posted: Mon Aug 25, 2014 1:38 pm
by donny
i used the code you made but $template shows everything else in the template. it strips the %USERNAME% fields but leaves everything after it

Re: Email order Form

Posted: Mon Aug 25, 2014 2:07 pm
by donny
if somebody can please help me with code that will do the above id be very grateful!!!!!!!!

Re: Email order Form

Posted: Mon Aug 25, 2014 2:11 pm
by Celauran
donny wrote:how can i do other fields ? also will i need to enclose it in %USERNAME% ? i don't get how this would work using my template

i will send them this in a email

name: %NAME% YOUR NAME HERE %NAME%
address %ADDRESS% YOUR ADDRESS HERE %ADDRESS%



they will send this back

name: %NAME% ROBERT JONES %NAME%
address %ADDRESS% 123 SESAME STREET %ADDRESS%

i want to make it into variables like this

$name = "Robert Jones";
$address = "123 Sesame Street";
Any reason you're not using a form here? Would make life a lot easier. How are you planning on parsing the emails?

Re: Email order Form

Posted: Mon Aug 25, 2014 3:16 pm
by donny
i am also using forms this is for people that cannot use the form and something i am using as a backup. people will email me with their info filled out. i will manually copy and paste the info. i want my code to process it how i showed in previous posts.

Re: Email order Form

Posted: Mon Aug 25, 2014 3:40 pm
by donny
this is going to be used for people that cannot use the web form. i want this as a another way to process forms via email . there may be better ways to do this but this is the way i am choosing to use as it will work for me. can anybody please help me by showing me an example of code for 2 fields i should be able to edit the script after that to make it work for the number of fields i need. thank you

Re: Email order Form

Posted: Mon Aug 25, 2014 3:59 pm
by Celauran
It's not even clear to me what you're trying to do. You mentioned entering data manually, but you're still asking about these variables. What am I not getting here?

Re: Email order Form

Posted: Mon Aug 25, 2014 5:16 pm
by donny
deleted

Re: Email order Form

Posted: Mon Aug 25, 2014 5:18 pm
by donny
deleted

Re: Email order Form

Posted: Mon Aug 25, 2014 5:26 pm
by donny
deleted

Re: Email order Form

Posted: Mon Aug 25, 2014 5:27 pm
by donny
deleted