I feel a little silly asking this but I wanted everyones opinion on it.
I want to submit a page, target itself, on the press of a button but carrying one piece of data with it.
Example:
Edit | Delete
On the click on edit, I want the page to reload with $_POST['example'] === "edit"
or something. I don't want to use $_GET
and I don't want to use the ugly submit button.
Any ideas?
You should probably go ahead and use submit buttons, but use CSS to change how they look.
For example:
<input class="aslink" type="submit" />
.aslink {
background: transparent;
border: none;
cursor: pointer;
text-decoration: underline;
}
You could use Ajax to submit a POST request or style a submit button to look like a link (or whatever else you'd like).
You could use the button tag:
<button type="submit">put some html</button>
You can put html tags or images in to it and style it to your hearts content.
Create form carrying the data you want to send and send it using JavaScript when you click a link if you want to avoid submit buttons.
You may submit your form via link.
<a href='#' onclick='document.myform.submit()'> Edit </a>
<input class="aslink" type="submit" />
.aslink {
background: transparent;
border: none;
cursor: pointer;
text-decoration: underline; }
ideally you would want to write the css out like this:
input.aslink
doing this will lock down those styles to ONLY being used by input tags with the appropriate class