Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Web Design & Development
Tag Cloud
access acer asus bios bsod computer crash desktop drive driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Loading PHP result into DIV using Ajax

Reply  
Thread Tools
Swanny86uk's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Dec 2006
Experience: Intermediate
05-Feb-2010, 05:09 PM #1
Loading PHP result into DIV using Ajax
Hi all,

I'm trying to get the result of an external PHP script (which processes form data) to load into a DIV on the same page as the submission form. Tried a few different ideas I've came across on the net but no luck so far. Does anyone have any ideas on how to do this or any links where I can find out - driving me mad this is

Cheers,

Marc
__________________
“I would love to change the world, but they won’t give me the source code”
Mr.LLB's Avatar
Member with 289 posts.
 
Join Date: May 2008
Location: Toronto, Ontario
Experience: Advanced
05-Feb-2010, 05:48 PM #2
can i see what you have done?
Swanny86uk's Avatar
Computer Specs
Member with 52 posts.
 
Join Date: Dec 2006
Experience: Intermediate
05-Feb-2010, 06:08 PM #3
Sure thing,

Got the following PHP code that performs a few calculations and then echo's them;

PHP Code:
<?php

        $field1 
$_POST['field1'];
        
$field2 $_POST['field2'];
        
$field3 $_POST['field3'];
        
$field4 $_POST['field4'];

        
$CurrentRevenue = (($field1 $field2) / 100) * $field3;
        
$PotentialRevenue = (($field1 $field4) / 100) * $field3;
        
        echo 
"&pound;".$CurrentRevenue "<br /><br /> " "&pound;".$PotentialRevenue;
?>
I want the result of the script (whatever I echo) to be printed within a DIV on the form page.

Any ideas?
Mr.LLB's Avatar
Member with 289 posts.
 
Join Date: May 2008
Location: Toronto, Ontario
Experience: Advanced
07-Feb-2010, 02:36 PM #4
http://www.w3schools.com/PHP/php_ajax_database.asp

^ this page gives you a good overview of what you need to do. your php script seems to be fine so just do the ajax part from this page
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:16 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.