Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Link a button thats already made

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #247276
    spitosdev
    Participant

    Hi, I have made a button that will link to an registration page. This is how I am so far:

    input type=”submit” name=”sumbit” value=”Create an account” class=”btn-registrer”

    Now I dont know how to link this to “Registrer.html page? I know that I can type <a href etc. but I have a full css to this button, so how do I link it?

    #247277
    Shikkediel
    Participant

    Is Registrer.html the page you land on after signing up? As I understand, you’d have to redirect the page after the button is pressed, not use the button as a link. But maybe you could clarify the situation, showing a bit more code could be helpful too.

    #247278
    spitosdev
    Participant

    Yes thats the page the button is going to redirect.

    This is how the “div” looks like:

    <form method=”post” action=”#” onsubmit=”return checkforblank()”>

    <input type=”text” id=”username” name=”username” placeholder=”Username”>
    <input type=”password” name=”password” placeholder=”Password”>

    <input type=”submit” name=”submit” value=”LOGIN” class=”btn-login”>
    <input type=”submit” name=”sumbit” value=”Create an account” class=”btn-registrer”>
    </form>

    #247334
    Shikkediel
    Participant

    So does it actually submit anything or is it just a link? In case of the first, use the php (I assume) you have applied through action to redirect. If nothing is submitted but the button is merely a redirect then just don’t give it the submit type but button instead and use JS to redirect.

    Many people here better at php than myself for sure.

    #247336
    Beverleyh
    Participant

    Looking at your form, you have a # in the action attribute, which can be used to submit to the same page in conjunction with a JavaScript handler. I see that there is a checkforblank() function but does this also submit the form to a process script (via AJAX)?

    If your page is a PHP page (or ASP or other server-side script), it could be submitting to itself, assuming that there is some sort of processing script within the the same page?

    Otherwise I would expect the action attribute to link to a file that contains a processing script. If that were the case, it would looking something like this &lt;form method="post" action="process-form.php" onsubmit="return checkforblank()"&gt;

    Basically, what I’m trying to say, is that you should have some sort of processing script that does something with the submitted form data. You would usually put a page redirect there – at the end of the script after your processes have executed. In your case, the part of the processing script that deals with the “Create an account” submission would redirect to your Registrer.html page (although it’s unlikely to work in a .html page unless your server has been setup to parse PHP/ASP in .html pages).

    #247338
    Beverleyh
    Participant

    Unrelated: I wasnt sure if you could have 2 submit buttons with the same names in the same form, but apparently you can. You just have to reference the value text in your processing script too http://stackoverflow.com/a/547848

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design’ is closed to new topics and replies.