[Pro] Is this possible to do????

Hi all,

I have a page where the visitor types their name and hits a button.

After they hit the button it brings them to the 2nd page and sends me an email of who visited.

Is it possible after they type their name in the box on 1st page, that their name appears on the 2nd page??

for example if they typed in Chris Smith in box and hit button, the next page would say 'Welcome Chris Smith"

here is the first page with the form box…

http://www.hoffkids.com/hwterms.html

Thanks so much for any tip…

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is one of the “Hello, World”s of programming exercises. Are you ready to learn a little PHP? You can set a cookie and read it on every following page. If you set a session cookie, then the name will disappear after they close their browser. If they return, they will have to enter it again. But if you set a long-lived cookie, then it will recognize them when they return, even years later.

Walter

On Oct 18, 2014, at 9:18 AM, Hoffkids email@hidden wrote:

Hi all,

I have a page where the visitor types their name and hits a button.

After they hit the button it brings them to the 2nd page and sends me an email of who visited.

Is it possible after they type their name in the box on 1st page, that their name appears on the 2nd page??

for example if they typed in Chris Smith in box and hit button, the next page would say 'Welcome Chris Smith"

here is the first page with the form box…

http://www.hoffkids.com/hwterms.html

Thanks so much for any tip…

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt,

I just want them to see it on the next page, each time (not years later).

I am ready for a very little PHP. Is it easy to enter?

the students and parents will love it!

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And you can do this in JavaScript, too, if you don’t want to change all of your page filenames from .html to .php just to do this thing.

Walter

On Oct 18, 2014, at 10:31 AM, Walter Lee Davis email@hidden wrote:

This is one of the “Hello, World”s of programming exercises. Are you ready to learn a little PHP? You can set a cookie and read it on every following page. If you set a session cookie, then the name will disappear after they close their browser. If they return, they will have to enter it again. But if you set a long-lived cookie, then it will recognize them when they return, even years later.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

is it all pages to .php or just the two pages we are talking about (the box page and the hello message page)?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

do I have to change all the pages to .php or just the 2 (the one with the form box and the page with the hello)?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Very easy. Let’s do it in JavaScript first, since that won’t require any changes to the rest of your site. First lesson of cookies — you can only read them on the NEXT page, not the current page. So if you set a variable in a cookie on one page, you can read it on the next, but not the current page.

  1. Apply Protaculous 2 to the page, if you haven’t already. In the Additional JavaScript Libraries section, enter ‘cookiejar’ (without the quotes) in the name field, and ‘http://cdn.freewaypro.com/cookiejar/1.5.1/cookiejar.js’ (without the quotes) in the CDN URI field.
  2. Click on the DOM Loaded Observer button, and enter this code: cookie-name.js · GitHub
  3. Draw an HTML box where you want the name form to appear, and insert a text field and a button in it. Name the text field ‘name’, using the Name/ID field of the Inspector, and confirm in the third tab that the Name attribute is properly set to ‘name’. Name the button ‘send’, using the same degree of care. Set the Value of the send button to whatever you like. (Optional: if you want the setting of the name to automatically navigate the user to the next page, then in the Page / Form Setup, set the Action to the actual filename of the second page, and the Method to GET.)
  4. On the second page, draw an HTML box where you want the name to appear, and type out a placeholder name. Using the Inspector, change the name of this HTML box to nameDisplay. When styling the name in the placeholder, make sure that you use a Paragraph style, not an inline (Inspector-made) style. Select the name, and make sure that the style that is highlighted in the Styles palette has a pilcrow (¶) before its name.
  5. On that same page, apply the Protaculous 2 Action, also include the link to the cookiejar script, and in the DOM Loaded Observer, type the following: cookie-read.js · GitHub

What this will do is redirect the user back to the index.html page if they haven’t entered their name (assuming of course that index.html is where that happens) so adjust that URL if it’s not correct.

Walter

On Oct 18, 2014, at 10:34 AM, Hoffkids email@hidden wrote:

Walt,

I just want them to see it on the next page, each time (not years later).

I am ready for a very little PHP. Is it easy to enter?

the students and parents will love it!

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

sweet- will try this weekend.

Thanks!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You may also find my old PHP Getting Started pages worth exploring. I
wrote them as a learning exercise for myself, expanded them into a
MacUser magazine feature, then put a version online here:
http://www.thehelpful.com/php/

This was some years ago, but there’s nothing here that’s out of date.
The Cookies section of the document doesn’t show exactly what you want
to do, but it’s very close!

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt,

Thanks so much for this last month… I have finally gotten around to doing it and despite not being totally finished (as I am trying next to get it to work with my PHP form so I get email notification), it is working as you said and very cool!

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt,

This is interesting…
I have followed all your above steps and even what Dave has mentioned to some degree to use the PHP feedback form as well to get a notification email.

Actually all is working as I imagined and seems too good to be true.
The only thing is, I cannot get the validate action to work with all I the javascript I have added.

for this student/parent HW page , I really would like it to work as it was before where something always had to be typed in the box or an error message displayed. I know people could just type anything, and I even know they could bookmark the 2nd page and bypass, but for 99.5% of the time it is used honestly and effectively.

So, do you think I can still get the validate action to work with our new “hello feature?”. Here is the new test page below. Just type your name in the box to see it in action.

if you do NOT type anything, it brings you to page 2 showing nameDisplay and a weird fast moving bar (that does not look good) near the top of the URL.

Thanks

http://www.hoffkids.com/testhwtypein.html

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

As I said in my email you have part of the script incorrect.

The section that reads

}else{
  window.location.href = 'testhwpage2.html';
}

Should read

}else{
  window.location.href = 'testhwtypein.html';
}

What this does is redirect the visitor back to the ‘log in’ page if they have not entered a name.

As it stands all it doing is redirecting the visitor to the page that they are on already - hence the ‘fast moving bar’ that you are seeing.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

you have part of the script incorrect.

Just to clarify, the error is on testhwpage2.html

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Dave,

I did that change. The result is if no name is typed in, it flashes the 2nd HW page and shows 404 error.
This happens if nothing is typed in box and button hit, or if just button pressed.

In a way, this is an improvement in that they have to type something in the box now, but it did not do as you thought where it redirected person back to login page.

On to the stuff in the email.

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I had a typo… I fixed the URL address in the code.

Now it does send the person back to the login page if they do not type in a name.

Unfortunately as of now, it sends me an email too (with no name) each time someone does that, but I will see your email about that stuff.

Thanks!!!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options