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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:58:12+00:00 2026-06-02T06:58:12+00:00

im new to php.i created a page in php containing chk boxes ,input fields

  • 0

im new to php.i created a page in php containing chk boxes ,input fields and retrive the data from the database(mysql) and also use the javascript.
i h’ve a problem in this ,that is i want to display the output in the same page.

i created the code like this,i want the output in same page,but it shows error.

<?php
if(isset($_POST['submit']))
{
  $con=mysql_connect("localhost","demosdef_review","review123");
if(!$con)
{
    die('could nt connect 2 the server');
}
mysql_select_db("demosdef_review", $con);
$state = $_POST["state"];
$country = $_POST['country'];

$contry = "USA";

if($country==1)
{
$result = mysql_query("SELECT address FROM storelocator WHERE countryid='1' AND id='$state'");
$row = mysql_fetch_array($result);
  echo $row['address'];
}
else
{
$result = mysql_query("SELECT address FROM storelocator WHERE countryid='$country'");
$row = mysql_fetch_array($result);
  echo $row['address'];
}

}
?>

    enter code here

        <div class=buy>
        <a href="dealer.php">Dealer Enquiry</a>
        </div><br/> 
        <div class=buyfont>Authorized Retailers</div>
        <div><a href="http://www.archiversonline.com/stores"><img src="images/archivers.png"><br/></a>
        <a href="http://www.archiversannex.com/Books-And-SoftwareSoftware-And-Accessoriesdefault.aspx?PageID=20&CategoryID=48"/>
        <img src="images/logo_archivers_annex.png" ></a><br/><br/>

    <a href="http://www.hobbylobby.com/storelocator"/><img src="images/logo_hobbylobby.png"></a><br/><br/>
    <a href="http://www.walgreens.com/storelocator/find.jsp"/><img src="images/logo_walgreens.png"></a></div><br/>
    <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>
    <p>
                <label for="country" style="padding-right: 2px;">Country</label><select name="country" value="countryid"
                 id="countryid" 
                onchange="sub()" style="width:120px;">
                <option value="1">USA</option>
                <option value="2">CANADA</option>
                <option value="3">UK</option>
                <option value="4">AUSTRALIA</option>
                <option value="5">ITALY</option>
                 <option value="6">GUATEMALA</option>
                <option value="7">NEW ZEALAND</option></select></p>
                <p>
<label for="state" style="padding-right: 14px;">State</label>
<select id="state" name="state" value="state"  style="width:120px">
<option value="7">Alabama</option>
            <option value="8">Alaska</option>
            <option value="9">Arizona</option>
            <option value="10">Arkansas</option>
            <option value="11">California</option>
            <option value="12">Colorado</option>
            <option value="13">Connecticut</option>
            <option value="43">Florida</option>
            <option value="14">Georgia</option>
            <option value="15">Idaho</option>
            <option value="16">Illinois</option>
</select></p> <br/>
     <input class="dealer-submit" type="submit" value="Submit" onClick="buy_func()"/>
                  </form>  
     <script type="text/javascript">
        function sub()

        {
    var x=document.getElementById("countryid").selectedIndex;
    var y=document.getElementById("countryid").options;
    var z = document.forms[0].state;
    if(y[x].index==0){
    z.disabled = false;}
    else if(y[x].index>0) {
    z.disabled = true;}}
        </script> 
  • 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-02T06:58:15+00:00Added an answer on June 2, 2026 at 6:58 am

    Your HTML markup has an error

    <a href="http://www.hobbylobby.com/storelocator"/>
    

    It should be

    <a href="http://www.hobbylobby.com/storelocator">
    

    Also try

    <form method="POST" action="">
    

    Keeping the action blank will post it to the same page itself

    And replace your submit button with this

    <input class="dealer-submit" type="submit" name="submit" value="Submit" onClick="buy_func()"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table created with PHP from an Sql Database that successfully displays
I have a Create new account page. The form is in page named Register.php
I a xampp setup for php. I have created a new repository at D:/xampp/htdocs/cart
I am using PDO with PHP to create a new database and then a
I'm trying to create a new project in NetBeans PHP from existing sources. When
I have created page that every new user is redirected to upon visit, it
i'm having a jquery variable containing so much formatted data created by ckeditor and
i created php page with these cookies : setcookie(0,hello+how+are+you,time()+30); in C# i wrote that
Is there a way to create a new HTML page from Javascript based on
I am new to JQuery and need som direction. I have created a page

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.