hello.
i get returned this error "user1 not defined".
the user1, user1, ... are an array
but somewhere is getting stuck
thanks a lot,
here is my code -
if(!isset($_POST['list'])){
-
?>
-
<form action="listings.php" method="post">
-
<input type="hidden" name="link" value="">
-
<?
-
echo '<select name="list[]" multiple="multiple">';
-
while ($row = mysql_fetch_assoc($result))
-
{
-
echo '<option>' . $row['username'] . '</option>';
-
}
-
echo '</select>';
-
?>
-
<input type="submit" name="submit" id="submit" value="Submit" />
-
</form>
-
<?php } else {
-
$usernames = $_POST['list'];
-
$link="http://www.exploretalent.com/model_page.php?talentnum=";
-
$IDS = implode('-',$_POST['list']);?>
-
<script type="text/javascript" >
-
var uids = new Array(<?php echo implode(',', $_POST['list']); ?>);
-
</script>
-
<a href="#" onclick="publishStream('<?php echo $link;?>',uids); return false;">Click to Publish on WALL.</a><?php }?>
-
-
here is the publishStream() that is called -
function publishStream(link,IDS){
-
var x;
-
for (x in IDS) { //- pass in array of ids, loop through the ids here.
-
streamPublish("Vote for me here", 'Visit Explore Talent', 'Checkout', link+IDS[x], "Facebook Application");
-
}
-
}
-
what about something like this? - <?php echo '"'.(implode('","', $_POST['list'])).'"'; ?>
8 2455 gits 5,390
Expert Mod 4TB
how doe's the JavaScript-array really look like? is it a valid JavaScript-array? is the array in any way extended by an additional lib (jQuery or whatever)? basically a JavaScript-Array must look like: - var arr = [1, 1, 2, 4, 'foo'];
the array is set up in php. im ['list'].
i am posting it in the select list.
\then i implore this variable: -
var uids = new Array(<?php echo implode(',', $_POST['list']); ?>);
-
witch is gonna return everything from the usernames field from my database.
then i send each result to that function
but i get that the results that come from UIDS (like: user1, user2, ...) are not defined
gits 5,390
Expert Mod 4TB
i see that - but does: - <?php echo implode(',', $_POST['list']); ?>
writes a comma separated list of strings or numbers? note that when it writes the values and those values should be strings then you would need to add the quotes around every element - otherwise that values are treated as variables that are of course undefined ...
if i use -
<?php echo implode('"', $_POST['list']); ?>
-
i get:
Error: missing ) after argument list
Source Code:
var uids = new Array(user1"user2"user3");
and
Error: uids is not defined
gits 5,390
Expert Mod 4TB
it has to look like this: - var uids = new Array("user1", "user2", "user3");
or better: - var uids = ["user1", "user2", "user3"];
if i use -
<?php echo implode('","', $_POST['list']),'"'; ?>
-
i get -
var uids = new Array(user1","user2","user3");\n
-
i cant get a " in the beginning of user1
by the way, thanks for taking some time to help me with this
gits 5,390
Expert Mod 4TB
what about something like this? - <?php echo '"'.(implode('","', $_POST['list'])).'"'; ?>
that worked :)
and now i click on this link: -
<a href="#" onclick="publishStream('<?php echo $link;?>',uids); return false;">Click to Publish on WALL.</a><?php }?>
-
and if goes to this function: -
function publishStream(link,IDS){
-
var x;
-
for (x in IDS) {
-
streamPublish("Vote for me here", 'Visit Explore Talent', 'Checkout', link+IDS[x], "Facebook App");
-
}}
-
the trick here is this IDS[x] to take one by one the whatever is returned from that array
the IDS are defined like this: -
$IDS = implode('-',$_POST['list']);?>
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: danny.myint |
last post by:
I was under the assumption that javascript loads all the <head></head>
elements before processing the <body> tag in Mozilla/Netscape/Firefox.
It doesn't seem like it, with my problem.
I have...
|
by: rashmi |
last post by:
how to use static function defined in one file in another file is that
impposiible in 'c '
|
by: jeniffer |
last post by:
Can a static function defined in a C file be ever referred (called)
externally from another C file?If so in which conditions?
|
by: Josiah Manson |
last post by:
I found that I was repeating the same couple of lines over and over in
a function and decided to split those lines into a nested function
after copying one too many minor changes all over. The only...
|
by: thisis |
last post by:
Hi All,
i have this.asp page:
<script type="text/vbscript">
Function myFunc(val1ok, val2ok)
' do something ok
myFunc = " return something ok"
End Function
</script>
|
by: Navaidstech |
last post by:
Hi all...
I'm new to Java programming. I've seen how finicky java is as far case
and space sensitivity sensitivity is concerned. However, I'm slowly
getting hang of it.
I came accross this...
|
by: ADS7328 |
last post by:
Dear everybody,
I trying to compile an aplication and i have got the following error
during
linking phase:
ld: fatal: symbol `K_MultiHandler_c::~K_MultiHandler_c #Nvariant 1()'
is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |