3 Replies - 2485 Views - Last Post: 01 August 2013 - 09:10 PM

#1 Hiatus   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 81
  • Joined: 27-May 09

How to make a submit button out of <a href> using PHP?

Posted 01 August 2013 - 08:42 PM

Hey all,

I was looking at megaupload's website and I liked how they made their submit button.

From what I can tell, the html is just:
<a href="#" class="login-button" id="login_button">Login</a>



I was wondering how they got this to turn into a submit button without using
<input type="submit">



Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: How to make a submit button out of <a href> using PHP?

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5552
  • View blog
  • Posts: 14,558
  • Joined: 18-April 07

Re: How to make a submit button out of <a href> using PHP?

Posted 01 August 2013 - 08:57 PM

The site is heavily powered by Javascript. No doubt they have an event tied to the link where when clicked it would read the login boxes and put it into a form for submission. Just disable your Javascript and try to run the site. You will see that it just gives you a blank page. Everything is dynamically loaded using JS and for sure the submission is done the same way.

:)
Was This Post Helpful? 0
  • +
  • -

#3 Hiatus   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 81
  • Joined: 27-May 09

Re: How to make a submit button out of <a href> using PHP?

Posted 01 August 2013 - 08:59 PM

Should I be using JS instead of PHP then? I thought PHP had a bigger following (more popular)?

And edit: With a bit of hacking around, I got the submit button to look like the a href!! CSS ftw!!

This post has been edited by Dormilich: 01 August 2013 - 10:29 PM

Was This Post Helpful? 0
  • +
  • -

#4 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5552
  • View blog
  • Posts: 14,558
  • Joined: 18-April 07

Re: How to make a submit button out of <a href> using PHP?

Posted 01 August 2013 - 09:10 PM

Well JS is a client side technology (for the most part) and PHP is server-side. Meaning that you can actually create a site that uses both. Just because mega upload makes their entire website built dynamically with JS doesn't mean you should. As pointed out, it has a flaw... if I don't have JS enabled I can't use their site.

What you should do is build on something like PHP and use JS for the smooth interface features and bells and whistles. Then plan for a fall back (aka fail gracefully) where if they don't have JS turned on, they can still get around and do the basic functions. This is how most websites are built. So I would still stick to the plan you have.

And as for your CSS, yeah you style the link to look like theirs, but then you use the JS to trigger the action of submission. :)

This post has been edited by Martyr2: 01 August 2013 - 09:10 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1