Web Design Forums

PHP

Have questions about PHP? Ask them here and our experts will assist you before you know it! You can also find help in the documentation at PHP.net.

Calling a JavaScript from PHP and processing return value



Site of the Month Nominations
ENTER YOUR SITE NOW!

Reply
 
LinkBack Thread Tools
Old December 23 '09, 02:04 PM (#1)
curare is offline
WDF Member
 
curare's Avatar
 
Join Date: February 2009
Posts: 48
curare will become famous soon enough
Calling a JavaScript from PHP and processing return value

I'm doing some work with Google Maps and need to batch process some locations from a CSV import and return the lat/long values to input into a database. My geocode lookup works fine, but I need to be able to call my code from PHP and get the return values.

Currently, I have a form to input locations one at a time and just call my gecode onsubmit wich works perfectly. But how can I call a JavaScript routine from PHP directly?

I was thinking something along the lines of:

PHP Code:
<?php
...

$address_string "123 Nowhere Ave., Somewhere, someplace, somezip, USA";

echo 
'<script type="text/javascript">find_location("$address_string"); return false;</script>';

...
?>
But I somehow have to get return values in my PHP, but one thing at a time. Any help is appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old January 12 '10, 07:46 AM (#2)
Anant is offline
WDF Member
 
Anant's Avatar
 
Join Date: February 2005
Location: Indore , India
Posts: 50
Anant is on a distinguished road
Send a message via Yahoo to Anant
Hi,

I have done some coding for this in my previous project. It might help you, although not able to understand your problem fully.

Home.php

<form name="search" class="cmxform" id="homeForm" action="<?php echo base_url(); ?>search/result" method="POST">
</div>
<div class="searchWhat">
<input type="text" name="searchTxtBox" id="searchTxtBox">
</div>
<div class="searchWhere">
<input type="text" name="cityTxtBox" id="cityTxtBox" value="<?php echo $city_where;?>" onblur="showAddress(this);">
</div>
<input type="hidden" id="citylatlng" name="citylatlng">
</div>
<script type="text/javascript">
function showAddress(address) {
$("#citylatlng").val('');
var geocoder = null;
var geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
$("#citylatlng").val(point);
} );
}
</script>
<div class="searchBtn">
<input type="image" src="<?php echo base_url();?>images/c2c-btn.jpg"/>
</div>
</form>

Hope this coding will help you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Web Design Forums » Programming Help » PHP

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Processing Form Script Error Abstract PHP 8 March 23 '09 10:15 PM
PHP Form processing... redirect durantz PHP 7 March 14 '09 08:39 PM
Prepared statements (PHP 5 / MySQL 4.1.x) rosland Coding Articles & Tutorials 0 February 25 '05 09:18 PM
ARRGH! php processing javascript and i can't stop it!! jf1288 PHP 1 August 14 '04 02:23 AM
Php script processing a flash form problem Bazrazmataz PHP 8 May 22 '04 06:04 AM

 
User Infomation
Your Avatar

Site Of The Month

Ticket Cake
Ticket Cake

Ticket Cake is a drupal based event ticketing platform. It features that ability to browse events and share them.

Nominate Your Site Now!

Advertisement
WolfCMS.org

Latest Articles
- by RickM
- by bfsog

Advertisement

Partner Links



All times are GMT -4. The time now is 02:46 AM.


WebDesignForums.net is Copyright © 2010 RikeMedia.

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163