Using text instead of Submit Button?? HTML / PHP

Posted on 2007-07-21
Medium Priority
Last Modified: 2008-08-21
How can I use a simple text as a Submit Button instead of Using a button??

I want to click on a text, and submit some info stored in a form (some input fields) and see it a in new windows (target=_blank).

How can i do it?? This is my current code, I DON'T want a button, I only want simple text. (I'm using PHP)

<form name='viewVotes' action='viewVote.php' method='POST'>
   <input type='hidden' value='28' name='photosid'>
   <input type='submit' value='view Votes'>
Question by:axtur

Expert Comment

ID: 19541361
Well, you could make a text link and use Javascript to have it submit the form:

<a href="javascript:document.viewVotes.submit();">

This will only work when the visitor's browser has Javascript enabled, though.

As for showing it in a new window, you'll want to specify a target window (that is, _blank) in your form:

<form name=... action=... method=... target="_blank">

You'll need to use PHP to process the form and supply the output HTML. Do you have this taken care of?
LVL 17

Accepted Solution

jasonsbytes earned 1000 total points
ID: 19541474
You should use a button, but style it so it looks like plain text, then you know it will work 100% of the time and the user doesn't have to have javascript enabled:

<style type="text/css">
   border-width: 0px;
   padding: 0px;
   margin: 0px;
   background-color: #ffffff;

<input type="submit" value="submit form" class="textButton">


Expert Comment

ID: 19541680
I wouldn't recommend using text, because of what TheAnarchist said. If a user does not have javascript, then the text button will NOT work.

I would however, recommend using a method, such as jasonsbytes, which makes a button LOOK like text.
LVL 13

Assisted Solution

R7AF earned 1000 total points
ID: 19542052
Style the button, and don't use javascript for this. You can even make it blue, underline it, and change the mouse to a hand when hovering over.

.textButton { border-width: 0px; padding: 0px; margin: 0px; background-color: #ffffff; color: blue; }
.textButton:hover { text-decoration: underline; cursor: hand; cursor: pointer; }

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question