Using text instead of Submit Button?? HTML / PHP

Posted on 2007-07-21
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
    LVL 6

    Expert Comment

    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

    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">

    LVL 5

    Expert Comment

    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

    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; }

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to count occurrences of each item in an array.
    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…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now