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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:29:57+00:00 2026-06-11T12:29:57+00:00

I cant get vars in php file. Echo returns nothing and I can’t make

  • 0

I cant get vars in php file. Echo returns nothing and I can’t make a query.
Please help me. I know there is few stupid mistakes, but I’m really tired to search it..

I have a form:

<form align="center" method="POST" action="saveuser.php">
<small>Choose person:</small>
<select name="user" id="user" size="1" onchange="loadUserData()">
    <option>Please select</option>
    <?php
        $con = mysql_connect('localhost', 'root', '');
        if (!$con) {
            die('Connection error: ' . mysql_error());
        }
        echo 'Connection Success';
        mysql_select_db("live", $con);

        $sql_query="SELECT name,id FROM res1";
        if(!mysql_query($sql_query, $con))
        {
            die('INSERT Error: ' . mysql_error());
        }
        $query = mysql_query($sql_query, $con);
        $max_row=0;

        while ($row = mysql_fetch_assoc($query)){
            if ($max_row !=0){
                echo "<option value={$row[id]}>{$row[name]}</option>";
            }
            $max_row=1;
        }

        mysql_close($con);
    ?>
</select></br>
<input id="id" type="hidden"/>
<small>Name: </small><input id="name" type="text" size="40" /> 
<small>Nat: </small><input id="nat" type="text" size="30" />
<small>Licence: </small><input id="licence" type="text" size="10" /></br>
<small>R1: </small><input id="r1" type="text" size="5" />
<small>R2: </small><input id="r2" type="text" size="5" />
<small>R3: </small><input id="r3" type="text" size="5" />
<small>R4: </small><input id="r4" type="text" size="5" />
<small>R5: </small><input id="r5" type="text" size="5" />
<small>R6: </small><input id="r6" type="text" size="5" />
<small>R7: </small><input id="r7" type="text" size="5" /></br>
<small>FO1: </small><input id="f1" type="text" size="5" />
<small>FO2: </small><input id="f2" type="text" size="5" />
<small>FO3: </small><input id="f3" type="text" size="5" /></br>
<button type="submit" name="submit">Save</button>

And php file saveuser.php:

<?php
$con = mysql_connect('localhost', 'root', '');
if (!$con) {
    die('Connection error: ' . mysql_error());
}
//echo 'Connection Success';
mysql_select_db("live", $con);

$id = $_POST["id"];
$name = $_POST["name"];
echo $id;
echo $name;

$sql_query="UPDATE res1 SET name='".$name."' WHERE id='".$id."'";
//,nat,licence,r1,r2,r3,r4,r5,r6,r7,f1,f2,f3 FROM res1 WHERE id='$value'";
$query = mysql_query($sql_query, $con);

mysql_close($con);

//$URL="edit.php";
//header ("Location: $URL");

?>

  • 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-11T12:29:58+00:00Added an answer on June 11, 2026 at 12:29 pm

    That is because you are not setting the name of the fields, id does not replace name:

    <small>Name: </small><input name="name" id="name" type="text" size="40" /> 
    <small>Nat: </small><input name="nat" id="nat" type="text" size="30" />
    // etc ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cant get a PHP file to send correct headers at my WAMP server.
I can't get my query to insert one of my vars while it is
How can I get my php vars to match whatever theme I am running.
Can someone explain why i cant get the desired delay between each request? They
I have an issue I cant get to the bottom of, so any help
I can do string=%s*3 print string %(var1,var2,var3) but I can't get the vars into
I'm trying to make a mod_rewrite which can set the language the rewrite: www.domain.com/da/page.php
I saw how get_object_vars works at php.net. The thing is that I can't make
I cant seem to get CI2's captcha helper to work... Can someone point out
Cant get this script to work with my menu really have tried everything any

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.