Multiple post or get

Started on the old forum in June 2011 · view the original in the archive · old links redirect here

8 replies · 442 views · started 15 years ago · 1 min read

6 participants
Jerson Developer · 70 posts #1

My problem is i dont know to edit multiple sql in just one click. I search the web but i cant understand their c0des. Code something like this <form action=update.php method=post> <input type=text name=id[] > then the submit. Haha i dont understand what is the function of id[] please help..

kei_ki7 Senior · 431 posts #2

What do you want to do?

Btw, try to make a multiple checkbox, search google for checkbox example Checkbox can carry multiple value so you can use array, you can view the value of the array using print_f, something like this

print_f($_POST['id']);

Did I help you? You can help me too Your donations will help me finance my studies.

Mysterio Lead · 630 posts #3

Why do you think people will help you if you are not able to understand a form, not able to explain us and not able to understand nor yourself.

mysterio.al - programming is a functional art

something else Fellow · 2,296 posts #4
foreach($_POST['id'] as $key=>$nid){ 
echo $nid.'<br/>'; //change this line to mysql update 
}

Added after 40 minutes:

$sql = "SELECT id FROM table WHERE field='".$field."' ORDER BY id";
$items = mysql_query($sql);
echo '<form action="update.php" method="post">';
while ($item = mysql_fetch_array($items))
   {
      echo '<input type="text" name="id['.$item.'] >'; 
   }
//rest of form here
leadiztah Developer · 55 posts #5

the syntax [] usually use for FOR loop..

for example <input type="checkbox" name="uname[]">

for(x=1,x>count,c++) { $username = $_POST['uname']; $username = $username[x]; mysql_query = ("DELETE FROM ibwf_users WHERE name='".$username."'") }

something like that 🙂 you are going to use [] because you have to insert something inside to it to get the value of the INPUT in FOR LOOP..

kei_ki7 Senior · 431 posts #6
$username = $_POST['uname'];
for(x=0,x<count($username),x++)
{
mysql_query = ("DELETE FROM ibwf_users WHERE name='".$username[$x]."'")
}

<input type="checkbox" name="uname[]">

nice example, deleting username 🙂

Did I help you? You can help me too Your donations will help me finance my studies.

Jerson Developer · 70 posts #7

Yah thanks to all of you.

I will use this in a information system.

Added after 42 minutes:

Maybe you dont understand while others do. do not post if you cannot contribute. This site is for noob and not for very professionals like you. Were here to study and not to be insult by arogant peoples. Thank you for wasting your ****ing time here. Hehe 🙂

kei_ki7 Senior · 431 posts #8

Jerson wrote: Yah thanks to all of you.

I will use this in a information system.

Added after 42 minutes:

Maybe you dont understand while others do. do not post if you cannot contribute. This site is for noob and not for very professionals like you. Were here to study and not to be insult by arogant peoples. Thank you for wasting your ****ing time here. Hehe :)

Can't get what you mean?

Did I help you? You can help me too Your donations will help me finance my studies.

ksg91 Developer · 162 posts #9

[] is used in form as an array. You can pass multiple value by it using checkbox.

For ex.

<form>
<input type="checkbox" name="x" value=1 />
<input type="checkbox" name="x" value=2 />
<input type="checkbox" name="x" value=3 />
</form>

will give you only one of those all selected values but if you use name="x[]" in form then it will pass all those selected values as an array.

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close