Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6817785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:05:52+00:00 2026-05-26T21:05:52+00:00

I call some links (opening table in the div) in the form <A HREF=#1

  • 0

I call some links (opening table in the div) in the form

<A HREF="#1" onClick = ?????>button 1<A>
<A HREF="#2" onClick = ?????>button 2<A>
<A HREF="#3" onClick = ?????>button 3<A>

I would like through the onClick function to send data (numbers: 1, 2, 3) and receive it in PHP in the same document. I guess I have to commit to this form.
How to do it?

EDIT ————————————-

I try the @gilly3 way

<script language="JavaScript">
function submitValue (n) {     
var f = document.forms.myform_1;     
f.myNumber.value = n;     
f.submit(); 
} 
</script>

<?php
global $PHP_SELF;
echo "<form action='". htmlentities($PHP_SELF)."' method=\"POST\" id=\"myform_1\">";
?>
<input type="hidden" name="myNumber" /> 
<a href="#1" onclick="submitValue(1)">button 1</a> 
<a href="#2" onclick="submitValue(2)">button 2</a> 
<a href="#3" onclick="submitValue(3)">button 3</a>
</form>

tested – working ok. thnks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:05:53+00:00Added an answer on May 26, 2026 at 9:05 pm

    Add hidden fields to your form. In your click handler, write whatever value you want to the hidden fields and call form.submit().

    function submitValue (n) {
        var f = document.forms.myForm;
        f.myNumber.value = n;
        f.submit();
    }
    

    Use it like this:

    <input type="hidden" name="myNumber" />
    <a href="#1" onclick="submitValue(1)">button 1</a>
    <a href="#2" onclick="submitValue(2)">button 2</a>
    <a href="#3" onclick="submitValue(3)">button 3</a>
    

    Or get the value from $_GET and skip the JavaScript:

    <a href="?day=1">button 1</a>
    <a href="?day=2">button 2</a>
    <a href="?day=3">button 3</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get some links for getting started with design patterns.My requirement
I would like to call some functions from a Fortran shared library in Python.
I have DLL and application that will call some function in this dll. For
i have some links in my page < a class=Qlink rel=20;5 href=javascript:void(0);>5</a> < a
I'd like to use this lightbox plugin for some autocomplete links, that don't yet
I have generated some html links with jQuery and appended it to some div
I'm trying to select some links in my content after an AJAX call, but
I have in my form a textarea where some links are stored via the
I have a jQuery function that runs through the page, finds links to a
I want to call some RESTful web services from a J2ME client running on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.