PDA

View Full Version : php to self populate existing form



theremotedr
02-15-2017, 12:05 PM
Please use this for as a guide, http://www.coothead.co.uk/coothead-form-test/test-form.html

Keeping the form as it is the only edit that is required are the following please.
"KEY CODE IF KNOWN" should be replaced with "PAYPAL EMAIL FOR INVOICE"

"VEHICLE MAKE" should be replaced with "PART NUMBER"

This is how it should work.
Customer visits this page for example, http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection
They decide to select from "ITEM SELECTION" Virgin Chip ID44
The item photo is then loaded,as you can see its part number is BMW007
They then click the button "CLICK TO ORDER"
They will now be taken to this new form of which we are making and it will be called form-order.
All the fields will then be completed by the customer BUT the field called "PART NUMBER" should have "BMW007" pre-filled.

Customer would then send me the completed form.
Once i receive the form the the part number of which was BMW007 should be in the form of a link like example below.

http://www.theremotedoctor.co.uk/m-images/emailref/Bmw007.html

Sometimes i need to use this link & by clicking on it takes me there.
6122

coothead
02-15-2017, 08:51 PM
Hi there theremotedr,


are you saying that this "part number" in the form will
remove the need for the "Chassis Number If Honda "?

I ask this because the "VEHICLE MAKE " was tied to it.



coothead

theremotedr
02-15-2017, 08:58 PM
Evening,

This will be a different from so not sure if we need to use a different named js, php etc etc.
This form does not require Vehicle Make etc.
Reason being people using this form will know what they require.
So I get the same details in the form + the part number they wish to order.
The other form is uploaded and I'm flicking through it as we speak.

theremotedr
02-15-2017, 09:02 PM
I forgot.
There is no need for chassis number on this form
If it easier for you include it BUT ONLY IF HONDA PART NUMBER is applied.

coothead
02-15-2017, 09:15 PM
Hi there theremotedr


do you want the form to look like the attached image?

Does the "Paypal" input need to be required * ?

If you no longer require the "chassis number", then
I would remove it, see image.


coothead

theremotedr
02-15-2017, 09:34 PM
That looks spot on.

Yes, PayPal is a required field.
Whist you are there, can the item of which the part number is for be includdd in my received email.
I mean in the form of its image ?

If not or to much work no problem etc.
Thanks very much.

coothead
02-15-2017, 10:13 PM
Hi there theremotedr,


How about if the form just submitted a link to the image instead?

This would mean having another input similar to the the "PART NUMBER".



coothead

coothead
02-15-2017, 10:41 PM
Hi there theremotedr,


just a thought, if we include "part number" and "image address" in
the form they do not really need to be visible to the user do they?

This is the normal method to use for pre-populated form elements.


coothead

theremotedr
02-15-2017, 10:45 PM
Ok fine.
Customer doesn't need to see these you are correct.

coothead
02-15-2017, 10:48 PM
...and would the image address instead of the image suit your purpose?


coothad

theremotedr
02-15-2017, 11:02 PM
Ok that's fine.

Sometimes I'm not sure what the item is so I click on s hyperlink to show me the page with the item in.
Like example at the start.
You know better than me so over to you.

coothead
02-15-2017, 11:35 PM
..this is how the form will look after hiding elements.

Do you have any pertinent comments to make before I
make an example form email submission for you to try?


coothad

theremotedr
02-15-2017, 11:50 PM
Only maybe Center the last left input field so it don't look lonely over there on the left.

coothead
02-15-2017, 11:54 PM
OK, I will see if I can get something working for you, after a little meditation. :D


coothead

theremotedr
02-16-2017, 12:04 AM
Ok thanks.
And don't forget what the Dr told you at the medical ;)

coothead
02-16-2017, 12:20 AM
for a moment I thought that I had typed "a little medication". :D

Actually, I do not have a doctor.

The last medication that I took was cannabis and that was quite a few years ago.


coothead

theremotedr
02-16-2017, 12:33 AM
That's different to what I listened to yesterday.

coothead
02-16-2017, 01:41 AM
Hi there theremotedr,


I have a test page for you try out....


http://www.coothead.co.uk/the-form-copy/accbmw.html

It didn't take as long as I expected. ;)



coothead

theremotedr
02-16-2017, 10:10 AM
Hi,
Spot on,
Ive completed the form,sent & received.

Link to photo works well.
This time i did look at the code but didnt see anything on the page for what you have done so i assume its in one of the other files.
I also did Ctrl & U to view the source of the link photo page but unable to even open anything.

Works well,thanks.

If if isnt to much trouble & if possible,
Can you alter the php output file so when i receive the form all is in capitals please & theres a little more space between each line.

Many thanks

coothead
02-16-2017, 10:44 AM
Hi there the remotedr,


I have made those PHP changes.

please try the link again to see if it works + cache clearing :D



coothead

theremotedr
02-16-2017, 10:56 AM
Morning,
Cache cleared but i see the following message when i try to submit.

We are very sorry, but there were error(s) found with the form you submitted. These errors appear below.
The Comments you entered do not appear to be valid.
Please go back and fix these errors.

coothead
02-16-2017, 11:00 AM
Hi there theremotedr,


Hold on, will look into that.


coothead

theremotedr
02-16-2017, 11:01 AM
ok
im here anyway thanks

coothead
02-16-2017, 11:44 AM
Hi there theremotedr,


I have tested it and it woks OK for me, see attached image.


The Comments you entered do not appear to be valid.

What exactly did you put in the "Message" box when you tested?

Try it again.:D


coothead

theremotedr
02-16-2017, 11:59 AM
Hi,
Well i did it twice this time and it worked ?
Not sure what i wrote but i did type something to get that message.


Request please.
How much trouble/time is it for you to edit the php file again ?
When i receive completed form Have the field comments & the actual message in a border/box etc
Can we also make the font weight darker.

If you show me in the php file once done i can alter it to my liking.

Many thanks.
Completed emails now received trying it again.

coothead
02-16-2017, 01:33 PM
Hi there theremotedr,


try it again as it may look rather different. :eek:


coothead

theremotedr
02-16-2017, 03:47 PM
Hi,
Unless the emails at present are really slow ive sent 2 but only received 1.
These 2 emails were sent at say 2.30pm

coothead
02-16-2017, 03:54 PM
I am testing at present, so it won't be working for you.

I will let you know when it's up and running again.

theremotedr
02-16-2017, 04:05 PM
ok

Thanks very much

coothead
02-16-2017, 06:47 PM
Hi there the remotedr,


I am sorry for the long delay.

There was a problem or two getting it to work properly with "Gmail".

It does now work, as long as you have a filter for "DR CONTACT FORM" - see attached image.

Try it out for yourself here...


http://www.coothead.co.uk/the-form-copy/accbmw.html



coothead

theremotedr
02-16-2017, 07:08 PM
Hi,
No problem as i am also having problems with pother stuff here.

I have completed the form,sent & received it.

I still get them going into the SPAM bin even when i have used a filter "DR CONTACT FORM"
I have also when created the filter asked it to be stared.
It stars the email no problem but its in the spam bin.

This form did not have any photo within it.
The one i received earlier this afternoon it did have.

See filter & received email photo below.

coothead
02-16-2017, 07:26 PM
Hi there theremote,


In "Gmail" i went to Settings => Labels and created a label called "good".

I then went to Settings => Filters and used the created label with the subject - "DR CONTACT FORM".

That appeared to do the trick for me.



coothead

theremotedr
02-16-2017, 07:36 PM
See attached image,no photo ?

theremotedr
02-16-2017, 07:39 PM
Sorry wrong image.
See correct one below.

coothead
02-16-2017, 07:47 PM
Hi there theremotedr,


well, the image that I posted earlier showed that the form image was rendered.

Have you tried adding a "good" label for the incoming email yet?

The attached image shows my inbox.


coothead

theremotedr
02-16-2017, 07:57 PM
Label created no problem But not sure what version of gmail you have as its different to mine in use.
I then went to Settings => Filters and used the created label with the subject - "DR CONTACT FORM".

In my settings i see filter & blocked addresses but then thats where its different i believe,i just see a lot of filtered emails here.

coothead
02-16-2017, 08:16 PM
Hi there theremotedr,


is it imperative that you use "Gmail"?

I have just tested the form with "hotmail" and it worked perfectly without using any filters.

Of course, neither of these are my main method for emails I use "thunderbird" with my original
internet provider "freeserve", which became "wanadoo" then "orange" and is now "EE".

To my mind "Gmail" seems to be a little too fussy for my liking and, of course, I've always
been a little wary of anything that "Google" has it's grubby little fingers in.

The reason that it looks different yo yours is that I have it set to "basic" rather than
"standard" as I find it less intrusive. :D



coothead

theremotedr
02-16-2017, 08:23 PM
What change did you make as i did receive one with a photo on.
I like gmail and use it on the phone so im used to it.

theremotedr
02-16-2017, 08:33 PM
ok wait a minute,ive just noticed something at my end

theremotedr
02-16-2017, 08:48 PM
Coothead are you testing as no completed forms now being received ?

theremotedr
02-16-2017, 08:51 PM
Ok,
I remember that i had checked the form earlier on my mobile of which i seen the image.
On my pc i need to click Display image below before its shown in the form
Once i click the text its shown no problem.

When i view the form on my phone its displayed no problem.


Still asking the question, are you testing or are emails just slow ?

coothead
02-16-2017, 09:07 PM
yes, I am testing again.

What I have found is that when you entered the Email Address * - theremotedr@gmail.com
no image was displayed, but when you entered the Email Address * - i.parsons68@btinternet.com
the image was displayed.

So that, obviously, is where the "Gmail" problem resides, as the same thing happened with my tests.

If you are intent on using "Gmail" you will have find out from Google a method to stop them blocking
your potential customers domains or go back to just having it's address displayed.

I await your comments with interest.

I will now return the php to your email address so that you can test my assertions yourself.



coothead

theremotedr
02-16-2017, 09:18 PM
Hmmm.
Not quite true,see attached image.

What ive seen is when i receive the form where the photo should be is just a square empty box.
Having said that i do now see a message from gmail to say click this to see image,i do and its then shown.

theremotedr
02-16-2017, 09:22 PM
forget my above message about not quite true.

Please allow me to complete and send a form or two a minute please.

theremotedr
02-17-2017, 11:11 AM
Morning Coothead.

Any update ?

Thanks very much.

coothead
02-17-2017, 12:26 PM
Any update ?
I can only repeat what I wrote in a previous post...


What I have found is that when you entered the Email Address * - theremotedr@gmail.com
no image was displayed, but when you entered the Email Address * - i.parsons68@btinternet.com
the image was displayed.

So that, obviously, is where the "Gmail" problem resides, as the same thing happened with my tests.

If you are intent on using "Gmail" you will have find out from Google a method to stop them blocking
your potential customers domains or go back to just having it's address displayed.


Gmail acts like a nanny to protect you from email addresses that
they don't like instead of letting the user make that decision.

If you're very not careful the "Google" buggers will try to come
round to your place and wipe your arse for you. :D


coothead

theremotedr
02-17-2017, 12:32 PM
I got that part ok.
I was refering to you testing as i couldnt send forms.
Have you finished testing ?

coothead
02-17-2017, 12:53 PM
if you look at the image I posted, it shows the time that I made my last test. ;)

The form is now set to your email address, so that you may continue yours :D


coothead

theremotedr
02-17-2017, 01:08 PM
I did see that BUT.
Was i supposed to have received that form,because i didnt ?
Also i sent a completed form at say 12.45 & have not received that either ?

Emails slow,not sure but if i send myself a test email just saying hello i get it with in seconds.

theremotedr
02-17-2017, 03:45 PM
Just an update.
The form you sent as per photo above at 12.19,ive never received it and not sure if i was suppose to ?

I also sent one at 12.45 but never received it.

I have just tried again at 14.40 and received it straight away.

I think the best thing to do is remove the image and put it back to a link so i can just click it,that way all was fine.

Once done please send a test form with the url link applied and also the code so i can then apply to my site.

many thanks

coothead
02-17-2017, 05:18 PM
Hi there theremotedr,


I have now changed the form to show the address of the image part.

There do not seem to be any Gmail problems - fingers crossed. :D

Check it out to destruction here...


http://www.coothead.co.uk/the-form-copy/accbmw.html

...then you can tell me what needs to be changed, if anything, and I
will prepare an attachment of the amended files used and also some
installation instructions.

It will keep you busy for quite a while. :eek:



coothead

theremotedr
02-17-2017, 06:09 PM
Hi,
Ive sent a few forms and all is fine,thanks very much.

I am now happy with the way it works.

coothead
02-18-2017, 01:06 PM
Hi there theremotedr,


check out the attachment for your product order form. ;)

Let me know if you have any installation problems.



coothead

theremotedr
02-18-2017, 01:42 PM
Hi,
I have done as advised,thanks very much.

With regards to this file, partNumber.js this is to be placed in the "js" folder
I see all my other js files are within a sub folder so if the above file is placed into a sub folder called orderform is it just a matter of updating one line of code somewhere to reflect this or does it get deeper involved and just leave it as you have advise.

Thanks for your time.

theremotedr
02-18-2017, 01:58 PM
HI,
Another question.
You mention that you have done accbmw file.
On that page in question http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection
I can click on any of the item under ITEM SELECTION then when i click on CLICK TO ORDER i am taking to the old order form ?

Please check it at your end and F5 this end etc made no difference.

Thanks

theremotedr
02-18-2017, 02:04 PM
Pc crashed,please wait until i restart and try again

coothead
02-18-2017, 03:10 PM
Hi there theremotedr,



With regards to this file, partNumber.js this is to be placed in the "js" folder

If you want to make a sub folder for it, you can if you prefer.

Personally, I can see no god reason to do this. :eek:

You did not put each HTML file in a sub folder, did you?. :D

Also note that this page...


http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection

...is working as expected for me - ( of course, I can't test whether it will submit successfully ).



coothead

coothead
02-18-2017, 03:37 PM
Hi there theremotedr,


I missed a "jotform" in the "order-form.html" - ( nothing to do with the submission ).

The code on line #364 of the file...



<a href="http://form.jotformeu.com/form/70306109032341">

...needs to be changed to this...



<a href="form-web.html">



coothead

theremotedr
02-18-2017, 04:18 PM
OK
I am back.
I have put the js file in a sub folder just to keep it like the others.
I assume the order-form.html file at line 407 is the only place that i do the following,correct ?

From,

<script src="js/partNumber.js"></script>

To,

<script src="js/orderform/partNumber.js"></script>

coothead
02-18-2017, 04:32 PM
Hi there theremotedr,


yes, that is correct.

I have noticed another minor error on line #275 of the "accbmw.html" file.

This code...



<a href="http://www.theremotedoctor.co.uk/form-mobile.html">

...should be changed to this...



<a href="form-web.html"



coothead

theremotedr
02-18-2017, 04:52 PM
js file now done & line #275 also done.
Now im ready to submit forms and if all ok then complete the other html pages.

coothead
02-18-2017, 05:07 PM
I do not see any change to line #275 :eek:


coothead

theremotedr
02-18-2017, 05:27 PM
Definatley done.

<a href="form-web.html"><img src="m-images/email-icon.png" alt="email the remote doctor" width="53" height="53" class="shadow"></a>

theremotedr
02-18-2017, 05:52 PM
Do you now see the code at line #275 ?
Also i have sent 8 order requests for all the items on the page in question shown below under the title ITEM SELECTION.... but have received 0 so far,these were all sent some 30 minutes ago.

http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection

styxlawyer
02-18-2017, 09:28 PM
I do not see any change to line #275 :eek:


coothead


Definatley done.

<a href="form-web.html"><img src="m-images/email-icon.png" alt="email the remote doctor" width="53" height="53" class="shadow"></a>


Do you now see the code at line #275 ?
Also i have sent 8 order requests for all the items on the page in question shown below under the title ITEM SELECTION.... but have received 0 so far,these were all sent some 30 minutes ago.

http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection

I think you may also need to change line #183.



<h1><a id="btnOrder1" href="order-form.html"><img src="m-images/order-logo.png" alt="order from the remote doctor website" class="buttonshadow"></a>

theremotedr
02-18-2017, 09:37 PM
Ok thanks.

I will wait for Coothead to reply as he has spent some time writing these files for me.
All the best.

coothead
02-18-2017, 10:10 PM
Hi there theremotedr,


can you tell me if the form here here...


http://www.coothead.co.uk/the-form-copy/accbmw.html

...still works for you?



coothead

theremotedr
02-18-2017, 10:21 PM
I've sent a form from my phone.
No reply straight away so I will give it 10 minutes just in case.

theremotedr
02-18-2017, 10:37 PM
Hi
No forms received.

theremotedr
02-19-2017, 12:02 AM
Could another member try this form please.
Go here http://www.theremotedoctor.co.uk/accbmw.html?scrollto=selection
Please select Virgin Chip ID44 under ITEM SELECTION.
Complete form then submit it.
Thanks.
Please put your username in the message box.
Please advise here that you have sent the form.

coothead
02-19-2017, 12:20 AM
Hi there theremotedr,


this is very strange. :eek:

Could you zip a copy of your "order_form_html_email.php" file and send it to me for another check?


coothead

theremotedr
02-19-2017, 12:23 AM
Ok
Will do in the morning.

coothead
02-19-2017, 12:29 AM
What is strange is that the php file is calling the "thank you page" with this...



header('Location: http://www.theremotedoctor.co.uk/thank_you_page.html');

...which is the final line of code in the document. :eek:



coothead

theremotedr
02-19-2017, 12:33 AM
Zip file sent as requested

coothead
02-19-2017, 12:46 AM
the php file is OK and exactly the same as others that work for me OK.

By OK, I mean that my tests to "thefirstcoothead@gmail.com" as
opposed to "theremotedr@gmail.com" work with this address...


http://www.coothead.co.uk/the-form-copy/accbmw.html



coothead

theremotedr
02-19-2017, 12:52 AM
I will now try the link in your post #75 now

theremotedr
02-19-2017, 12:52 AM
As a matter of fact which item are you selecting from the list ?

coothead
02-19-2017, 01:06 AM
the link in post #75 should send the form to my email address rather than yours?

I use random items when testing.

I will swap it over to you email address now though, so you might possibly get emails. ;)


coothead

theremotedr
02-19-2017, 01:12 AM
OK
You should have received 2 emails then.
Both in the comments box i put text relating to where it was sent from etc etc
Did you receive them ?

theremotedr
02-19-2017, 01:14 AM
tell me once done please

theremotedr
02-19-2017, 01:33 AM
Coothead.

I have just sent a form and have received it no problem.

coothead
02-19-2017, 01:35 AM
Hi there theremotedr,


what time did you send them?

I swapped the email address to the "theremotedr@gmail.com" at 1:06am. ;)



coothead

theremotedr
02-19-2017, 01:52 AM
Hi,
I sent 2 just before 1am did you receive them ?

I then sent one at 1.30 and received it straight away.

I then sent one at 01.45 but time now is 01.53 but as of yet nothing received.

theremotedr
02-19-2017, 02:06 AM
Hi,
On this page http://www.html-form-guide.com/email-form/php-script-not-sending-email.html
I have installed the test php file below part A simple script to test your PHP –> mail configuration
I have clicked submit say 8 times and straight away receive the 8 test emails fine.

How about we try and add a $from_add = "theremotedr@gmail.com"; to the form and just see what happens ?

coothead
02-19-2017, 02:14 AM
Hi there theremotedr,


I have done a little research and have now managed to resolve the problem. :D

It turns out that "Gmail" chokes on "\r" in PHP emails.

There were four in our form...



$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";//ISO-8859-1

...and I have now removed them.

Replace your version with that in the attachment.;)

Further reading:-


http://johndoesdesign.com/blog/2012/php/getting-your-php-html-email-to-render-in-gmail/

I nearly forgot your "paypal email field" problem.

Replace your "screen.css" file with that in the attachment.




coothead

theremotedr
02-19-2017, 10:41 AM
Morning.
I added the files as mentioned above.
F5 the system and completed the form.
This was 30 minutes ago.
As of yet no email.
I will wait a while just in case and then reply back here.

Many thanks for sorting the above out.

coothead
02-19-2017, 11:10 AM
Hi there theremotedr,


the tests to my "Gmail" account at 2:30am were very successful.

I have, just now, made three submissions to yours - fingers crossed.:D


coothead

styxlawyer
02-19-2017, 01:14 PM
Message sent at 13:14 UCT.

theremotedr
02-19-2017, 02:15 PM
Message sent at 13:14 UCT.

Thanks but nothing received either,now 14:15