Submit html form with link

В самом начале страницы — давайте разберемся!

Если вам нужна кнопка submit в виде ссылки, без исполнения «post», то смысла в создании submit + форма вообще не вижу — воспользуйтесь простой ссылкой.

Если вам нужно, чтобы «post» исполнялся и «submit» в виде ссылки — это можно понять. и далее перйдем именно к этому:

Ссылка submit и исполнение post

Данный пункт написан последним, поэтому весь код возьму из последнего пункта.

Но для перехода на другую страницу нам потребуется дополнительная страница(в моем случае это простая html страница)

Добавим action в него помещаем адрес страницы, на которую перейдем:

На странице action-а помещаем простой код php, смотри ниже в коде — «Страница №2 php»

Код submit как ссылка и исполнение post

Далее у нас должно быть две страницы :

На первой странице форма со стилями и action на вторую страницу , и submit как ссылка.

На второй странице код php.

border-bottom: 1px solid #ff000000;

Php Страница №2 php(action в форме): https://dwweb.ru/__a-data/__all_for_scripts/no_etv/php/submit_like_link.php

if($_POST[name3]) echo ‘Вы перешли по ссылке «submit» и отправили «post»
‘ . strip_tags($_POST[name3]);

else echo ‘Ещё ничего не отправлено’;

Пример работы кода submit как ссылка и исполнение post

Чтобы submit в виде ссылки сработал, нажмите по кнопке Ссылка submit и исполнение post

submit и есть ссылка

Но некоторая проблема данного варианта, что javascript может быть отключен.

Поскольку я периодически и таким способом пользуюсь, то этот вариант пусть будет здесь.

Для того, чтобы сделать нам нужна форма.

Далее создадим ссылку на которую навесим submit()

Пример ссылка вместо кнопки submit

Кнопка submit как ссылка.

И второй вариант — сделаем кнопку отправить ссылкой:

Читайте также:  Php добавить строку массив

Для этого нам опять понадобится тег form с input с типом submit

Далее. превратим «submit» в ссылку. Для этого напишем немного стилей.
1). Удалим border + background
2). Добавим нашему «submit-link» border-снизу + padding — снизу + cursor

input.submit-link <
border: none;
background: none;
border-bottom: 1px solid;
padding-bottom: 2px;
cursor: pointer;
>

Что нам еще нужно добавить к нашему «submit-link«? Правильно! hover :

Источник

Link Submit button to Another page using forms Tags in HTML In HTML’s Form tag we can Link submit Button to a different page using HTML Form’s Action Attribute.
Where we have to Declare/Write the Submit button Between HTML Form Tags and we have to assign our File Path inside HTML form’s action attribute.
Later when the user clicks the Form Button, It will redirect that user to another page.

Youtube: How to Link Submit Button to Another Page in HTML [Updated]

Linking Submit buttons using Anchor Tag is Easy and Reliable method in HTML. We need to Write/Declare Submit button between Anchor tag’s Starting and Closing tags.
By using Anchor tag’s href attribute we can give a Path where we want to Link our Submit Button.

If you don’t need to use Form tag or Ancher tags to Link Submit button to a different page in HTML then we can use JavaScript for such cases. In JavaScript, we design a Function which will manage all the Data like Page Path where we want to Connect our Submit Button. The function name, By using that Function name we can call that function within HTML onClick attribute. Which we call the assigned function and we can redirect our users from one page to another by clicking on the Submit Button.

How to Link Submit Button to Another Page in HTML [Updated]

To link a button to another page in HTML, we can use 2 Different methods.

   document.getElementById("myBtn").addEventListener("click", myFunction); function myFunction() < window.location.href="http://programminghead.com"; >  

submit button redirect to another page HTML

To redirect users to another page using Submit button we can use HTML’s Ancher tag or Form tags for that.
In Anchor tags and Form Tags, we need to Write/Declare our Submit button between Anchor tags or Form Tags.»
Which will make our Submit button Clickable. And by using Anchor and Form tag’s href attribute we can Specify the Path where we want our users to redirect after clicking the Submit Button.
Redirect using HTML Form Tags

Redirect using HTML Anchor Tags

CODE : how to link one page to another page in html using button

The Process of linking Submit button to another page in PHP is very Similar to HTML.
Because we can use HTML Elements inside PHP Document and Submit buttons are usually created using HTML Tags.
So using HTML Anchor tags or HTML Form Tags we can link submit button to another page in PHP.
Redirect using HTML Anchor Tags

Читайте также:  Fields and properties in java

index.php [Redirect using HTML Anchor Tags]

index.php [Redirect using HTML Form Tags]

To make input type submit link to another page, we can use HTML Anchor Tags or HTML Form Tags to Do that.
To Link HTML Input type submit Button to another page in HTML using HTML Anchor tags, we have to declare/write our HTML input type submit button between Anchor Tag’s Starting and Closing Tags. In HTML Anchor tag’s href attribute, we have to give our Another Web page’s link (Where we want to Link out Input type submit Button).
To Link HTML Input type submit to another page using HTML Form tags, we have to declare/write our HTML input type submit button between HTML Form Tag’s Starting and Closing Tags. In HTML Form tag’s Action attribute, we have to give our Another Web page’s link (Where we want to Link out Input type submit Button).

how to handle multiple submit buttons in HTML forms

In HTML Forms all the Buttons inside Form Tags will work like a Submit button. Which will redirect users to the same page (Which we have declared inside HTML form’s action attribute) If you want to Handle multiple Submit buttons then you can use Multiple Form tags with multiple Page Path. or you can use Anchor tags instead of Form tags to redirect Users using multiple submit buttons in HTML link submit button to another page using JavaScript.

   document.getElementById("submitBtn").addEventListener("click", myFunction); function myFunction() < window.location.href="http://programminghead.com"; >  

JavaScript windows.location allows us to redirect our users to another page on a single click. We just need to add a Click event inside our JavaScript. Which will run when user Invoke the Click Event by clicking the Submit button.

a href Submit form onclick

Yes you can Link / Open another page using HTML Anchor Tags / A Href Method. For that you have to provide your Another page’s Link inside Anchor tags href attribute. Which will open your Linked page on a Single Click.

redirect to another page after form submit html

If you want to redirect to another page after form submit html, Then you have to provide/Sign the Other pages path inside HTML Form tag’s ACTION Attribute. Which will POST/Send your Form data to that Location and Open/Redirect your Users to That Given Web Page.

on submit go to another page in html

If you want your Users go to another page in HTML, we can use HTML Anchor tags. Which allow us to make HTML Elements like Submit Button Click Able and Linked with Another Pages.
So whenever our User will click the Submit button, Anchor tags will redirect that user to another page (Which page we specify inside Anchor tag’s href attribute).

Читайте также:  Command line parser cpp

To make HTML form submit button link to another page, we have to use HTML’s Form tags or HTML Anchor Tags.
HTML Anchor is used for linking HTML Elements to Another Page. Where a user can be redirected to a page using a single button click.
In HTML Anchor tags we have to use its href attribute to write external file path (where we want to redirect our Users).
And
HTML Form tags allow us to Show Form data and also allow us to link that Form data to another page using HTML Form tag’s Action Attribute.
This method is Basically used for POSTING and Getting HTML Form Data using PHP but we also can use this Method to Link our Submit button to another Page.

html submit button redirect to another page

To make HTML submit button redirect to another page, we have to use HTML’s Form tags or HTML Anchor Tags.
HTML Form tags allow us to Show Form data and also allow us to submit that Form data to another page using HTML Form tag’s Action Attribute.
And
HTML Anchor can link any HTML Element to Another Page. Where a user can be redirected to a page using a single button click.
In HTML Anchor tags we have to use its href attribute to write external file path (where we want to redirect our Users).

html form submit to another page

To make HTML form data submit to another page, we have to use HTML’s Form tags.
HTML Form tags allow us to Show Form data and also allow us to submit that Form data to another page using HTML Form tag’s Action Attribute.
We are using PHP file to POST and Show our HTML Form Data.

To add an submit button with link in HTML, we need to use HTML’s Anchor tags. Which allow us to Add links or making HTML Elements Clickable / Linked with another Page.
To add links to am HTML Submit Button, Write that Submit button between Anchor tag’s Starting and Closing tags.
and using Anchot Tag’s href Attribute, we can write our HTML File’s Path (Where we want to link our HTML Submit Button).

or you can use JQuery Ajax which can redirct you to another page after Form Data Submission. Click Here to Download JQuery Library.

submit button redirect to another page html

To make submit Button Redirect to Another page in HTML we have two Methods.
First : By using HTML Anchor Tags.

and by using HTML Form tag’s Action Attribute

Источник

Оцените статью