[PHP] mixture of GET and POST
I have 3 'action' buttons and I am trying to send the $id from the radio button and the action to the same page so I can either, Add Edit or Remove the property from the database. Any ideas how I can get this to work? I can either POST the id's or GET the action but I can't seem to return both to the browser. Ta, R. -- form id=form1 name=form1 method=post action= div id=button_holder a href=?action=addid=?=$id;?Add Property/a a href=?action=removeRemove Property/a a href=?action=editEdit Property/a /div div id=table_header /div table id=properties_table ?php $query = SELECT * FROM properties; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ ? trtd class=col_one input type=radio name=id value=? echo $row['property_id'];?/td td class=col_two?php echo $row['property_id'];?/td td class=col_one?php echo $row['address'];?/td td class=col_two?php echo $row['postcode'];?/td td class=col_one£500/td td class=col_twoLive/td /tr ? } ? /table /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mixture of GET and POST
This has nothing to do with php, I suggest you read up on how html forms work and you may need to learn some javascript. clive. I have 3 'action' buttons and I am trying to send the $id from the radio button and the action to the same page so I can either, Add Edit or Remove the property from the database. Any ideas how I can get this to work? I can either POST the id's or GET the action but I can't seem to return both to the browser. Ta, R. -- form id=form1 name=form1 method=post action= div id=button_holder a href=?action=addid=?=$id;?Add Property/a a href=?action=removeRemove Property/a a href=?action=editEdit Property/a /div div id=table_header /div table id=properties_table ?php $query = SELECT * FROM properties; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ ? trtd class=col_one input type=radio name=id value=? echo $row['property_id'];?/td td class=col_two?php echo $row['property_id'];?/td td class=col_one?php echo $row['address'];?/td td class=col_two?php echo $row['postcode'];?/td td class=col_one£500/td td class=col_twoLive/td /tr ? } ? /table /form -- Regards, Clive. Real Time Travel Connections {No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mixture of GET and POST
Mainly you have to add a javascript to submit on click (plenty of them by searching on google). You don't need the href links (I think they're wrong anyway), you can just have # instead, and you should pass the params to the submit function. Simple search on google for your case: http://www.quirksmode.org/js/forms.html -- itoctopus - http://www.itoctopus.com clive [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This has nothing to do with php, I suggest you read up on how html forms work and you may need to learn some javascript. clive. I have 3 'action' buttons and I am trying to send the $id from the radio button and the action to the same page so I can either, Add Edit or Remove the property from the database. Any ideas how I can get this to work? I can either POST the id's or GET the action but I can't seem to return both to the browser. Ta, R. -- form id=form1 name=form1 method=post action= div id=button_holder a href=?action=addid=?=$id;?Add Property/a a href=?action=removeRemove Property/a a href=?action=editEdit Property/a /div div id=table_header /div table id=properties_table ?php $query = SELECT * FROM properties; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){ ? trtd class=col_one input type=radio name=id value=? echo $row['property_id'];?/td td class=col_two?php echo $row['property_id'];?/td td class=col_one?php echo $row['address'];?/td td class=col_two?php echo $row['postcode'];?/td td class=col_one£500/td td class=col_twoLive/td /tr ? } ? /table /form -- Regards, Clive. Real Time Travel Connections {No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mixture of GET and POST
As mentioned, this isn't a PHP issue really, except a little bit on the receiving end. Why not use multiple 'submit' buttons instead of using HREF links? input type=submit name=action value=Add input type=submit name=action value=Edit input type=submit name=action value=Remove In PHP, you'd just check the value of $_POST['action'] You can also do it with image submit buttons, just have to change the name of each one: input type=image name=action_add src=images/add.jpg input type=image name=action_edit src=images/edit.jpg input type=image name=action_remove src=images/remove.jpg In PHP, you'd check for the existance of $_POST['action_add.x'] or $_POST['action_add.y'] or the corresponding X and Y for edit and remove. It sends the coordinates of where on the image the user clicked but works just like a submit button, so you'll get your radio data too. If you're dead set on using HREF links, then you're going to have to use some Javascript to probably set some values (possibly in a hidden form element) and submit the form. -TG = = = Original message = = = I have 3 'action' buttons and I am trying to send the $id from the radio button and the action to the same page so I can either, Add Edit or Remove the property from the database. Any ideas how I can get this to work? I can either POST the id's or GET the action but I can't seem to return both to the browser. Ta, R. -- form id=form1 name=form1 method=post action= div id=button_holder a href=?action=addid=?=$id;?Add Property/a a href=?action=removeRemove Property/a a href=?action=editEdit Property/a /div div id=table_header /div table id=properties_table ?php $query = SELECT * FROM properties; $result= mysql_query($query); while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) ? trtd class=col_one input type=radio name=id value=? echo $row['property_id'];?/td td class=col_two?php echo $row['property_id'];?/td td class=col_one?php echo $row['address'];?/td td class=col_two?php echo $row['postcode'];?/td td class=col_one~500/td td class=col_twoLive/td /tr ? ? /table /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php