Re: php & javascript

From: Date: Wed, 03 Oct 2001 11:45:18 +0000
Subject: Re: php & javascript
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-69752@lists.php.net to get a copy of this message
> document.myform["email[]"] seems to give me a syntax error. Check if your already using "" you'll need to use single quotes as so: <input type="button" name="CheckAll" value="Check All" onClick="checkAll(document.myform['email[]'])"> (tested on IE 5.5 and NS 4.08, works) >> If you leave it as email, you can then convert the email variable into an array using explode() or split() as so: > On the recieving page I have echo($array = implode (",", $email)); which echos the array of text box values just fine. but only if the input name=email[] not name=email, and email[] doesnt work since my javascript uses email, not email[] If you want to continue using email[], the above advise should be okay, and no need to read on. If you want to use email, instead of echo(implode(",", $email)), just echo($email), then you can use explode() when you want the array. <?php // When using $email, not $email[] // The comma seperated string: echo($email); // The array: $ar_email = explode("," $email); // The array glued for viewing: echo(implode (",", $ar_email)); ?>

« previous php.general (#69752) next »