We help IT Professionals succeed at work.

Trouble with online calculator after converting site to wordpress

Kasonde Neddy
on
Hi experts,

Converted a site to wordpress, and had an online calculator that heavily used Javascript/Jquery, once converted to Wordpress, some values are missing from the calculator.  Don't know why???  Lost..and baffled.  please try to use the calculator at the following link:

http://www.madisonassets.co.zm/education-calculator/

Select country and enter some details and click calculate...notice the missing values? Can you help me resolve this to see and know why the values are missing? but outside wordpress it is working fine.
Comment
Watch Question

Hi kasondeneddy,

Could you please provide us with a link to a working version outside Wordpress?
Kasonde NeddyDesigner & Developer

Author

Commented:
Hi media-tips,

I have just activated a link with the working version, below:

http://www.easywebzambia.com/mamco/education_calculator.php
Checking your scripts I found out that they're not identical.

In the working script you have:
<form id="ecalc" method="get" action="education_calculator.php">
	:
<div class="caption">
	:
<form id="ecalc" method="get" action="/mamco/education_calculator.php">

Open in new window


In the non-working script you have:  
<form id="ecalc" method="get" action="http://www.madisonassets.co.zm/education-calculator/">
	:
<div class="caption">
	:
<form id="ecalc" method="get" action="#">

Open in new window


and also the folowing error when you populate the departments list:  
<select id="departments" name="departments">

Warning:  mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/n/e/d/neddynedson/html/easyweb/mamco/education_calculator.php on line 366

Warning:  mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/n/e/d/neddynedson/html/easyweb/mamco/education_calculator.php on line 366

Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/n/e/d/neddynedson/html/easyweb/mamco/education_calculator.php on line 367
No departments selected!
</select>

Open in new window


So, I suggest that you first fix the points below, and then we'll investigate further.
Kasonde NeddyDesigner & Developer

Author

Commented:
I had changed it because of wordpress URLS..

<form id="ecalc" method="get" action="education_calculator.php">


I do not have education_calculator,php inside my wordpress page and therefore had to change it, I ll look into the other mysql error.

I had a felling that is were the problem is, the "action", in wordpress my is generates using permalink strucutre which i am sure affects things.

Yes, you're probably right.

Then, you colud try something like that in your form:
action="<?php get_bloginfo('template_directory'); ?>/education_calculator.php"

Here's a link to Wordpress bloginfo documentation:
http://codex.wordpress.org/Function_Reference/bloginfo

You could also switch to a Worpress custom form.

See: http://nabtron.com/how-to-code-custom-contact-form-in-php-in-wordpress/1793/
Kasonde NeddyDesigner & Developer

Author

Commented:
Thanks, sorry for closing late, had a bit of a backlog on other work!  Solutions worked fine with a bit of tweaaking!