First let me show you what im trying to do..
go to Under Construction! and go to google.com or whatever, then hover over favorites and click Add This Page, bookmark management should then popup, scroll down. see all the bookmarks? how you can edit them, change folders, delete them, what not, well that doesnt work yet, how do I make it so each one will perform there own action, even though all the input types have the same name? (delete, url, favtitle, favfolder)
multiple actions in one form
Started by phpforfun, May 23 2008 04:28 PM
8 replies to this topic
#1
Posted 23 May 2008 - 04:28 PM
Checkout my new forum! http://adminreference.com/
|
|
|
#2
Posted 23 May 2008 - 05:41 PM
<input type="text" name="url[]" />That will submit an array, which you can then iterate through.
Edited by John, 23 May 2008 - 05:43 PM.
#3
Posted 23 May 2008 - 05:52 PM
so...
Echo $url[];
would echo "12345"?
<input type="text" value="1" name="url[]" /> <input type="text" value="2" name="url[]" /> <input type="text" value="3" name="url[]" /> <input type="text" value="4" name="url[]" /> <input type="text" value="5" name="url[]" />and
Echo $url[];
would echo "12345"?
Edited by phpforfun, 23 May 2008 - 06:26 PM.
Checkout my new forum! http://adminreference.com/
#4
Posted 23 May 2008 - 06:38 PM
im trying to get it to show multiple values... Its not working too well.
The test page is Untitled Document
I think its this line: if($check[$num] === "yes"){
<form id="form1" name="form1" method="post" action="">
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="text" name="url[]" />
<input type="checkbox" name="check[]" value="yes" /><br />
<input type="submit" name="Submit" value="Submit" />
</form>
<?
if(isset($_POST['url'])){
$url = $_POST['url'];
while(list($key,$value) = each($_POST['url'])){
$num = $key + 1;
$url2 = $value;
if(isset($_POST['check'])){
$check = $_POST['check'];
if($check[$num] === "yes"){
Echo "$url2 checked<br>";
} Else {
Echo "$url2 unchecked<br>";
}
}
}
}
?>
The test page is Untitled Document
I think its this line: if($check[$num] === "yes"){
Edited by phpforfun, 23 May 2008 - 06:51 PM.
Checkout my new forum! http://adminreference.com/
#5
Posted 23 May 2008 - 06:44 PM
Glad you got it. Out of curiosity, is there a reason you capitalize Echo?
Untested, but something like this should work:
Untested, but something like this should work:
if(isset($_POST['url'])){
foreach($_POST['url'] as $url){
echo $url;
}
}
#6
Posted 23 May 2008 - 06:52 PM
Bunp, john, check the post above your last
Checkout my new forum! http://adminreference.com/
#7
Posted 24 May 2008 - 11:22 AM
anyone know how I can get multiple values and pair them up?..
Checkout my new forum! http://adminreference.com/
#8
Posted 26 May 2008 - 07:44 PM
I guess I could just make the values of the check box's the id of the bookmark, durr
Checkout my new forum! http://adminreference.com/
#9
Posted 13 June 2008 - 12:55 AM
What you searching, John have posted right answer for you!
www.jarmalavicius.lt | www.github.com/reekenx | www.twitter.com/reekenx


Sign In
Create Account


Back to top









