I have a form html code that uses POST to submit data to a server. What I'm trying to do is get the URL string that would essentially submit the same data, but without having to use the form. How would I do this? <form method='post' action='gym.php'> <table class='customtable2'> <tr> <td><b>Strength</b></td> <td><input type='text' size='5' value='0' name='str' id='strength_q' /></td> <td colspan='2' align='center'></td> </tr> <tr> <td><b>Defense</b></td> <td><input type='text' size='5' value='0' name='def' id='defense_q' /></td> <td colspan='2' align='center'></td> </tr> <tr> <td><b>Speed</b></td> <td><input type='text' size='5' value='100%' name='spd' id='speed_q' /></td> <td align='center'><button class='button small brown' type='button' onclick="$('#strength_q').val('33%');$('#defense_q').val('33%');$('#speed_q').val('33%');"><span>Split</span></button></td> <td align='center'><button class='button small' type='submit'><span>Train</span></button></td> </tr> </table> </form> Code (markup):
If you want to use post, you have to use an HTTP post request either through a form or wih PHP's cURL. I think what you need is a get request ($_GET) which passes data via variables within the url, for example: On the HTML side: <a href="www.mysever.com/index.php?strength=8&speed=10&defense=5" title="Click to send">Send to server</a> Code (markup): Then on the server side use $_GET array to retrieve the values, like so: if(!empty($_GET)) { if(array_key_exists("strength", $_GET)) { $strength = $_GET["strength"]; } } Code (markup): I also recommend you don't use HTML tables, they're terribly outdated so use CSS.
as BRUM said, you'd need to use GET instead of POST -- the entire reason to use POST is so that it isn't passed through the URL! That's what POST is for. ... and yeah, lose the tables -- and while at it lose the B tag's doing LABEL's job, the empty colspans doing padding or margin's job... basically throw 50% of that markup in the trash