undefined variable error

Vladimir Skenderaj

Nuovo Utente
13 Gen 2014
4
0
0
Tirana, Albania
ciao a tutti.sto faccendo un profilo.php...ho creato una diagramma sql dove ho salvato le informazioni degli user.ho fatto la connessione del php con sql...ma il programma mi dice undefined variable :username e undefined variable:email...questo e il mio codice php
PHP:
<?php 
mysql_connect("localhost","root","1234");
mysql_select_db("albguide");
if(isset($_POST['submit']))
{
$user_id=$_REQUEST['user_id'];
$get=mysql_query("SELECT * FROM user WHERE user_id='$user_id'");
$username = $_GET['username'];
$email=$_GET['email'];
}

?>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FF00CC" text="#000000">
<p align="center"></p>
<p align="center">My Profile</p>
<p align="center">
<div class="widget"align="center">
<html>
<head>
<script type="text/javascript">
function updatepicture(pic){
document.getElementById('image').setAttribute("src",pic);
}
</script>
</head>
<body>
<form action='upload.php' method='post' enctype='multipart/form-data'target="iframe">
<input type='file' id='file' name='image'/>
<input type='submit' id='submit'  value='Upload'/>
</form>
<img style="min-height:250;min-width:300;max-height:250px;"id="image"/><br/><br/><br/></p>
<iframe style="display:none;" name="iframe"></iframe>
</body>
</html>
<p align="center"></p>
<div class="widget"align="center">
<h2>Username</h2>
<p align="center"></p>
<p align="center"><?php echo $username ?></p>
<p align="center">
<h2>Email</h2>
<p align="center"></p>
<p align="center"><?php echo $email ?></p>
<p align="center">
<form action='editsetting.php' method='post' enctype='multipart/form-data'>
<input type='submit' id='submit' value='Settings'/>
</div>
  
</form>
</body>
</html>
Spero di avere una risposta al piu presto possibile.
Grazie in anticipo
 
Ultima modifica di un moderatore:

edin

Utente Attivo
7 Nov 2013
92
0
6
www.edinweb.altervista.org
Forse volevi fare così:

PHP:
$result=mysql_query("SELECT * FROM user WHERE user_id='$user_id'");
$username = mysql_result($result,0,'username');
$email=mysql_result($result,0,'email');
 

flameseeker

Utente Attivo
27 Nov 2013
699
0
0
Prima di tutto vorrei chiederti di copiare precisamente gli errori che visualizzi, è importante.
 
Discussioni simili
Autore Titolo Forum Risposte Data
L [PHP] risolvere problema Undefined variable PHP 0
L [risolto] Undefined variable: in programmazione oop PHP 12
P Problema di Undefined variable nel codice PHP PHP 5
M errore Undefined variable sql_mode PHP 6
G Undefined index PHP 11
S Errore PHP - Notice: Undefined index ... PHP 14
K [PHP] Notice: Undefined index PHP 3
G Errore Cannot read property 'childNodes' of undefined per mancanza nodo nel file xml XML 6
A [PHP] Undefined index dopo query dal server PHP 1
Q Notice: Undefined index: codice in C:\xampp\htdocs\STAGE\calendario\modifica.php on line 10 PHP 8
C [PHP] Errore "Fatal error: Call to undefined function getTotalUsers()" PHP 2
elpirata [PHP][RISOLTO] Errore di tipo Notice: Undefined index - Come risolvere quando si hanno tante var PHP 10
M [RISOLTO] jQuery non funziona... valore "undefined" jQuery 2
A errore: Unable to get property 'inline' of undefined or null reference jQuery 1
U [PHP] form per ricerca multipla: Unknown column 'undefined' in 'where clause' PHP 2
MilanMilan [PHP] Notice:Undefined index PHP 2
G Fatal error: Uncaught Error: Call to undefined method UserController PHP 0
O Fatal error: Call to undefined function testNome() in C:\xampp\...\...\index.php on line 51 PHP 4
Shyson Notice: Undefined index ma non trovo l'errore PHP 8
P Fatal error: Call to undefined method SMTP::setTimeout() PHP 4
S Notice: Undefined index: azione in PHP 6
J Problema con questo errore Error was: Undefined index: title linea 9 PHP 21
L problema con l'Undefined index per una $_GET PHP 6
P Notice: Undefined index: PHP 11
R Undefined offset in php PHP 29
P radiobutton e index undefined PHP 4
L Notice: Undefined index in versione classe PHP 1
M fatal error: Call to undefined function gdrcd_filter() PHP 6
L Risolvere i problemi dei messaggi:-> Notice: Undefined index PHP 3
C Variabile Undefined PHP 13
I Notice: Undefined index: utente in C: PHP 14
G Variabile undefined Javascript 5
F Fatal error: Call to undefined function PHP 9
L Problema con Undefined index . PHP 1
L Fatal error: Call to undefined method Paging::listaPagine() PHP 2
N problemi con notice undefined index PHP 16
O Notice: Undefined index PHP 12
borgo italia Undefined index PHP 12
S responseText undefined? Ajax 3
E Sys is undefined Ajax 1
L Notice: undefined constant PHP 3
P Undefined constant PHP 5
H Call to undefined function: oci_parse() PHP 0
L Fatal error: Call to undefined function virtual() in C:\Inetpub\wwwroot\... PHP 1
P Call to undefined function mysql_connect() PHP 2
B Valori Radio "undefined" Javascript 5
D 800a005b object variable or with block variable not set Classic ASP 3
S 404 Error " Page not Find" Error SEO e Posizionamento 0
L Error Code: 1215. Cannot add foreign key constraint MySQL 3
M HTTP Status 500 - Internal Server Error. Java 0

Discussioni simili