Anyway, I get tired of typing the same crap over and over so sometimes I use JS to grab stuff from my html page and spit it out into the page in a way that I can use. Tonight I was grabbing POST info via php for a form. I made this little snippet to write out all of my input IDs surrounded by the stuff I needed to just paste it into the php code.
Code: Select all
$("form input, form textarea").each(function(){
var theID = $(this).attr("id")
$("#info").append('$' + theID + ' = $_POST["' + theID + '"];<br />');
});
Code: Select all
$zip = $_POST["zip"];
$title = $_POST["title"];
$time = $_POST["time"];
$address1 = $_POST["address1"];
$geotag = $_POST["geotag"];
$photograph = $_POST["photograph"];
$equipment = $_POST["equipment"];
$tags = $_POST["tags"];
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$email = $_POST["email"];
$url = $_POST["url"];
$description = $_POST["description"];
Code: Select all
$("form input, form textarea").each(function(){
var theID = $(this).attr("id")
$("#info").append(theID + ', ');
});
Code: Select all
zip, title, time, address1, geotag, photograph, equipment, tags, fname, lname, email, url, description,
Will