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 8298593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:50:07+00:00 2026-06-08T15:50:07+00:00

In my index file where the form and function are located, named: index.php $(function()

  • 0

In my index file where the form and function are located, named:

index.php

$(function() {
    $.ajax({
        type: "POST",
        url: "invtype.php",
        data: "getrevenuetype=true",
        success: function(b){
            $("#revenueType").html(b)
        }
    })
})

<span name="revenueType" id="revenueType"></span><br/>

invtype.php

<?php

mysql_connect("","","") or die('Error: '.mysql_error());
mysql_select_db("dbname");

if(isset($_POST['getrevenuetype'])) {
    $sql3 = mysql_query("SELECT * FROM chartofaccount WHERE accountnumber >= 4000 and accountnumber <= 4999");
    $acct = '';
    $acctrow = mysql_num_rows($sql3);
    if($acctrow > 0) {

    echo 'Revenue Type:<select name="rename">';
        while($chartrow = mysql_fetch_array($sql3)) {
        $revenueaccountname = $chartrow['accountname'];

    $acct .= '<option value="$revenueaccountname"> '. $revenueaccountname .' </option>';

    }

    }
}

echo $acct;
echo '</select>';

My question is how will I get or what code should I put on to get the value of the option selected by the user? My purpose in getting the value is that I want to put it in another php where it will be used as var in inserting data into MySQL. already tried this code: $name = $_POST['rename']; then included ‘invtype.php’; on the other php file (this is where I will use the value of option selected) but it doesn’t seem to work. I know my code is all messed up and I’m really sorry about it, but guys if you can help I would really appreciate it.

  • 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-08T15:50:09+00:00Added an answer on June 8, 2026 at 3:50 pm

    you need to add , for example, ‘ for first time response

    echo $acct;
    echo '</select>';
    echo '<input type="submit id="submit" value="" />';
    

    than add js

    $('#sumbit').click(function(){
     var name = $('select[name=rename]').val();
    
       $.ajax({
          type: "POST",
          url: "invtype.php",
          data: "rename=1&name="+name,
          success: function(b){
            $("#revenueType").html(b)
        }
       })
    
    });
    

    than change invtype.php

    if(isset($_POST['rename'])) {
     $name = $_POST['name'];
    
     //work with base 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am having an form for uploading an excel file like <form enctype=multipart/form-data action=http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7
I'm wondering if it is possible to pass form data from index.jsp file to
I have 3 file index.php, .js file, and a.php file. i made a ajax
i have an easy ajax script which sending data to php file with no
I am using ajax post method to post the form like :- $(function ()
I have file upload using jquery form plugin as $(function() { $(#Form).ajaxForm({ iframe: true,
I'm renewing question. For simplify situation I've this script in index.php file <form name=f
my website is based off of only one php index file that changes the
I have a index.php file which loads (require) 2 different files based on a
I have an index.php file which has 2 included files require(stats.php); require(stats_encry.php); stats.php which

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.