Forum Moderators: open

Message Too Old, No Replies

Callback to form element

Like the calendars that are out there

         

NOT skeletor

5:22 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



I have a new window opening that performs a search in PHP to populate a table from MySQL with a username and a number. This is in a little link beside a form text-input field. What i would like is for someone to click on one of the entries in this table, and the number be automatically put into that form-field.
I use a calendar from someone that does exactly this, but I am too new to Javascript to figure out all the variables and functions that are needed to do this. I would very much appreciate a hand with this.
Please be long-in-tooth with an explanatoin as I am good at PHP but learning the ins-and-outs of Javascript and would really like to get this going. Any other info you need as per requests.
Thanks in advance!

kniceguy2know

9:47 pm on Apr 22, 2004 (gmt 0)

10+ Year Member



I can't say that I completely understand the question but it sounds like something that I implemented so I'll give it a go. First things first - I think that solution can be managed entirely with php. Here's how in rough terms-
(no table formatting)

while or for loop to get data from mysql
{
echo username and number;
echo "<a href=\"www.ursite.something?param=".loopindex.">link name</a>";/* this creates a link for every entry and, when clicked, stores the index of that entry in variable param which can be used to fill in the textbox*/
}

?>
<form ....................>
<input type="text" name="mytext" size="50" value="<?php if ($param) echo whateveruwant;?>" >
</form>

Very rough - but I think it will give you the general idea.

NOT skeletor

9:03 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



Thanks for the reply!
I actually figured it out on my own. One simple line!
Anyway, for posterities sake, heres what it looks like:

page1.php
<form name="something">
<input type="text" name="otherthing"><a href="javascript pop up window thinger">
etc etc etc

page2.php
<a href=\"#\" onClick=\"opener.document.forms.SOMETHING.OTHERTHING.value='$searchreult';window.close();\">

This opens a new search window, searchs the database, returns and array. Then, each entry of the array has a hyperlink, which then fires that value back to the original window into the text form area.

Thanks for the reply again, though.