php - Unable to Insert Data into MySql Table using username from another $_POST function -


    echo "hello : ".$_session['doc_username'];       //username sent different page post method      $username = $_post['username'];      echo "<p><strong>showing health information : </strong>";echo $username; "</p>";       if($_post['submit'])      {      $height = mysql_real_escape_string($_post['height']);     $weight = mysql_real_escape_string($_post['weight']);   if($height && $weight) {     require "dbc.php";     $query = mysql_query("update patient_info set      height='$height',weight='$weight' username='$username'");     echo "patient data saved!"; }  else  {     echo "all fields required!"; } 

the problem code not in mysql query. have checked syntax errors using phpcodechecker , there none. there more variables inserted database height , weight example. problem getting username different page post method , cannot save in way used "submit" value in form enable updating of particular username. because username other form $username cannot referred within $_post in page, username variable blank when click submit button. how can username sent page page post used in form in update query. form send username page proven when can echo username out. cannot used form in page. please new php codes , i'm trying best can.

first of replace line:

from:

if($_post['submit'])  

to:

if (isset($_post['submit'])) 

if using combobox check have provided name parameter in markup like:

<select name="submit"> ... </select> 

[edit]

after analyzing code found html markup written after form element. think issue. rest appears ok.

hope solve issue.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -