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

  • SEARCH
  • Home
  • 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 9157391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:00:19+00:00 2026-06-17T13:00:19+00:00

First I have this. <form method=post action=<? echo $_SERVER[‘PHP_SELF’]; ?>> <input type=text name=varenummer id=varenummer

  • 0

First I have this.

<form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="varenummer" id="varenummer" onkeyup="gethint(this.value)" hidden=true style="display:none">
</form>

And then later on I have this

if (isset($_POST['tryk'])) {
$pri = mysql_real_escape_string($_POST['pri']);
$sek = mysql_real_escape_string($_POST['sek']);
$dat1 = mysql_real_escape_string($_POST['dat1']);
$dat2 = mysql_real_escape_string($_POST['dat2']);
$dat3 = mysql_real_escape_string($_POST['dat3']);
$dato = $dat1 . "-" . $dat2 . "-" . $dat3;
$tek = mysql_real_escape_string($_POST['tek']);
$id1 = mysql_real_escape_string($_POST['id1']);
$varenummer = mysql_real_escape_string($_POST['varenummer']);

$insert = mysql_query("insert into Servicetxt (ID2, Servicenum, PriServiceTxt,
SekServiceTxt, Teknikker, Dato, Varenum) VALUES ('NULL', '$id1', '$pri', '$sek', '$tek',
'$dato', '$varenummer')")or die(mysql_error());    
}

The thing is, the submit-button ‘tryk’ is placed on an ajax page. How can I save the value of the textbox(varenummer) as a php-variable before the isset($_POST[‘tryk’]), without pushing any button?

  • 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-06-17T13:00:21+00:00Added an answer on June 17, 2026 at 1:00 pm

    PHP is the sever-side programming language while JavaScript (jQuery) runs on the client-side.

    we can use PHP to write JS, but JS can’t affect PHP (except via AJAX or similar).

    What you can do is use SESSION

    here is sample code.

    Js Code

    $("#varenummer").change(function(e)
    {
        e.preventDefault();
        var data_posts = $(this).val();
    
        // Send Ajax request to backend.php
        $.post("/backend.php", {"varenummer": data_posts});
    });

    PHP Code

    <?php
        // do any authentication first, then add POST variable to session
        $_SESSION['varenummer'] = $_POST['varenummer'];
    ?>

    And the you can use that session variable globally as $_SESSION is SUPER-GLOBAL itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form: <input type=checkbox value=First />First <input type=checkbox value=Second />Second <input type=checkbox
I have two forms. The first form is the mainForm, this never goes anywhere.
I have a form which has First Name, Last Name text boxes, Radio button(Yes
Using Dozer to map two objects, I have: /** /* This first class uses
I have this issue: first, I execute a SQL query using Java and then
I have this middleware which is the first: class RedirectIt require net/https require uri
I have this class file call SMSHelper.cs First I just wanted to know is
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
I have this file which I need to read the first bytes to check
I have this view (DetailsContainer, first class in code section of this question) with

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.