Page 1 of 1

change profile page

Posted: Fri Oct 20, 2006 5:36 am
by rik088
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hello, 

i have made a profile page and now i wana make a page to change ur profile but i get errors can any1 help me ?

this is the script

Code: Select all

<?php

session_start();
include("connect.php");
include("functions.php");




if($_SERVER['REQUEST_METHOD'] == "POST") 
{
   
		$userid   = $_GET['userid'];  
		$naam     = $_POST['naam']; 

        $email       = $_POST['email'];
     
        $woonplaats    = $_POST['woonplaats'];
        $voornaam    = $_POST['voornaam'];
        $achternaam        = $_POST['achternaam'];
        $geboortedatum        = $_POST['geboortedatum'];
        $land        = $_POST['land'];
		$lengte        = $_POST['lengte'];
		$kleurogen       = $_POST['kleurogen'];
		$gewicht        = $_POST['gewicht'];
		$piercing       = $_POST['piercing'];
		$tatto        = $_POST['tatto'];
		$kledingstijl        = $_POST['kledingstijl'];
		$hobbys        = $_POST['hobbys'];
		$muziekstijl        = $_POST['muziekstijl'];
   
       $query = "UPDATE `profile` SET `naam` = '$naam', `email` = '$email', `woonplaats` = '$woonplaats', `voornaam` = '$voornaam', `geboortedatum` = '$geboortedatum', `land` = '$land',
         `lengte` = '$lengte', `kleurogen` = '$kleurogen', `gewicht` = '$gewicht', `piercing` = '$piercing', `tatto` = '$tatto', `kledingstijl` = '$kledingstijl', `hobbys` = '$hobbys', `muziekstijl` = '$muziekstijl',
                                                   WHERE id = ['$userid'].'" ;

if(mysql_query($query))
{ 
echo "HIJ DOET HET!!!!";
} 
else
{
echo "FOUT";
}
}      
       


if(!isset($_POST['submit']))
{
$select = mysql_query ("SELECT * FROM `users` WHERE `naam` = '".isset($_GET['naam'])."'");
$data = mysql_fetch_assoc($select);
       }
?>
<html>
<head>
<title>Profiel Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="aanpassen.php" method="post">
    <input type="hidden" name="<? $id ?>">
  Naam:
  <input type="text"  readonly name="naam" value="<? echo"".$_SESSION['naam'].""; ?>">
  <br>
  Email adres:
  <input type="text" name="email" value="<? echo "".$data['email'].""; ?>">
  <br>
  Woonplaats:
  <input type="text" name="woonplaats" value="<? echo "".$data['woonplaats'].""; ?>">
  <br>
  Voornaam:
  <input type="text" name="voornaam" value="<? echo "".$data['voornaam'].""; ?>">
  <br>
  Achternaam::
  <input type="text" name="achternaam" value="<? echo "".$data['achternaam'].""; ?>">
  <br>
  Geboortedatum:
  <input type="text" name="geboortedatum" value="<? echo "".$data['geboortedatum'].""; ?>">
  <br>
  Land:
  <input type="text" name="land" value="<? echo "".$data['land'].""; ?>">  
  <br>
  Lengte:
  <input type="text" name="lengte" value="<? echo "".$data['lengte'].""; ?>">
  <br>
    Kleurogen:
    <input type="text" name="kleurogen" value="<? echo "".$data['kleurogen'].""; ?>">
  <br>
    Gewicht:
    <input type="text" name="gewicht" value="<? echo "".$data['gewicht'].""; ?>">
  <br>
    Piercing:
    <input type="text" name="piercing" value="<? echo "".$data['piercing'].""; ?>">
  <br>
    Tatto:
    <input type="text" name="tatto" value="<? echo "".$data['tatto'].""; ?>">
  <br>
    Kledingstijl:
    <input type="text" name="kledingstijl" value="<? echo "".$data['kledingstijl'].""; ?>">
  <br>
    Hobbys:
    <input type="text" name="hobbys" value="<? echo "".$data['hobbys'].""; ?>">
  <br>
    Muziekstijl:
    <input type="text" name="muziekstijl" value="<? echo "".$data['muziekstijl'].""; ?>">
  <br>
  <input name="submit" type="submit" value="Aanmaken">
  <br>
</form>

</body>
</html>
the error i get = Notice: Undefined index: userid in c:\inetpub\wwwroot\inlog\aanpassen.php on line 13

line 13 is $userid = $_GET['userid'];


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Oct 20, 2006 6:33 am
by impulse()
I think it's because you don't define $id anywhere.

Code: Select all

<input type="hidden" name="<? $id ?>">
THe $id part is never defined.

Re: change profile page

Posted: Fri Oct 20, 2006 7:05 pm
by Jade
rik088 wrote: if($_SERVER['REQUEST_METHOD'] == "POST")
{

$userid = $_GET['userid'];
Are you passing userid in the URL? For example: http://www.mydomain.com/page.php?userid=3
If not then it might be having problems trying to get the userid if there to get.