...

View Full Version : Passing Map Points from Client to Server Values



jameslove
08-21-2007, 02:25 AM
I can get the javascript to gather an array of map points and pass them to a <Select, however after I submit and run a simple PHP echo script on $points to show the data, nothing comes up.

What am I missing. I must be doing something simple and stupidly wrong here. How is it suppose to be done. I'm missing a key concept in how variables are passed from client to server.

Here's what I am doing as of Aug. 20 at 6:30pm PST.

http://www.jameslove.com/gpolygon.php

<form name="form1" method="post" action="">
<select id="pointList" name="points" multiple size="14" onChange="highlight(this.selectedIndex)"
onDblClick="jumpToPoint()" name="select">
</select>
<br/>
<input type="button" value="Delete All Points" onClick="deleteAllPoints()" name="button"/>
</p>

<div align="center">
<input type="submit" name="done" value="Done">

mcjwb
08-21-2007, 01:26 PM
You are adding the points to the select list correctly but you will need to select the entry/entries you want to submit. Remember that only the selected item(s) in a select list get submited.

You need a bit of javascript to select all the items in the select list prior to submitting the form, something like this:

function form_submit() {
var i, oform = document.forms['form1'];
for (i=0; i< oform.elements['points'].length; i++) {
oform.elements['points'].options[i].selected = true;
}
oform.submit();
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum