Forums / General Questions / How do I add a submit button to an EZ Page?

How do I add a submit button to an EZ Page?

Views: 1,137

Results 1 to 8 of 8
27 Jun 2011, 6:34 AM
#1
misstish avatar

misstish

New Zenner

Join Date:
Dec 2010
Posts:
18
Plugin Contributions:
0

How do I add a submit button to an EZ Page?

I'm creating an EZ-Page with a submit button on it and I don't know where to do the processing when the submit button is clicked.

Any help would be appreciated. :frusty:

27 Jun 2011, 8:50 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

depends on what is being "processed"... more info needed please.

20 years a Zencart User

28 Jun 2011, 12:14 AM
#3
misstish avatar

misstish

New Zenner

Join Date:
Dec 2010
Posts:
18
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

I want to add a Google Maps function to let other clients see where to locate consultants. In an ez page I will request an address or zip code from the visitor with which to locate the nearest consultants. This action I want to be triggered by a submit button.

I have created the ez page with its input text boxes. I would appreciate some guidance on to which php file I should add the processing? If you, schoolboy, or anyone else can help I would so appreciate it.:frusty:

29 Jun 2011, 12:02 AM
#5
misstish avatar

misstish

New Zenner

Join Date:
Dec 2010
Posts:
18
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

Thanks! Since the submit button's onclick event is by default javascript; I will try calling a javascript function with the address array to do the processing. Since I must access the database in PHP to create an address array I have found a function that will save the array of php records into a javascript array (Yow!).

I hope to get it going and post the code. :lamo:.
If there is any other advice out there, I would welcome it.

4 Jul 2011, 5:41 AM
#6
misstish avatar

misstish

New Zenner

Join Date:
Dec 2010
Posts:
18
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

We have added a new form in an EZ Page with a submit button that calls a new php file. When the new php file runs, it calls a new function added to /includes/functions/functions_customers.php. The function needs to do a database query so it declares "global $db;" just like the other functions in this file. When the function runs, it does some echo statements so I know it is running but when it gets to "$result = $db->Execute($query);" it fails with an error message that $db is not an object. The new php file is not in a Zen Cart folder but in a new folder we created (if that matters). Our version of functions_customers is attached as a pdf. :bangin:

4 Jul 2011, 10:30 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

What if you create the page OUTSIDE of zc (including the PHP drivers) and then bring it into your EZ page inside an <iframe>.

By keeping the processing inside the iframe, the drivers are external to the ezpage.

We do this with MachForm forms from Appnitro.

See an EXAMPLE... (take a look at the page source for the location of the iframe)

20 years a Zencart User

4 Jul 2011, 11:17 PM
#8
misstish avatar

misstish

New Zenner

Join Date:
Dec 2010
Posts:
18
Plugin Contributions:
0

Re: How do I add a submit button to an EZ Page?

schoolboy, thanks for the suggestion and for the example; I'll give this a try.
In the meantime, I've moved my php file to /includes/functions/extra_functions and now it runs as soon as I load the home page but at least it can now use $db to run the database query. I thought I could now just add a notifier so it only runs on demand but I'm not sure how to do that so I'm looking at the example in the wiki. If you, or anyone else, have any suggestions on that, please let me know.
Your idea seems easier to implement, though, so I'll try it first. Thanks again.