profile script!

Codes here !

Moderators: macek, egami, gesf

Post Reply
php-punk
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk
Contact:

profile script!

Post by php-punk » Thu Jul 03, 2003 1:29 pm

right i have made a profile script for the reviews on my website, i got most of it working, up untill the user wants to update the profile CODE:

Code: Select all

<html>
<head>
</head>
<body>
<center><iframe frameborder=0 src="http://to-j.com/ad2.htm" width="120"
height="60" target="_blank" scrolling="no"> </iframe></center>
</body>


<?php
switch($change){
default:
$c = mysql_connect("localhost","","") or die(mysql_error());
$db = mysql_select_db(punk_style_to_j_com);
$query_Recordset1 = "SELECT * FROM users WHERE user='$user'";
$Recordset1 = mysql_query($query_Recordset1,$c) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="pragma" content="no-cache">
</head>


<body bgcolor="#0099FF">
<p><img src="" width="144" height="139">
</p>
<p>&</p>

//DISPLAYING THE PROFILE

<p><B><font color=\"#FFFFFF\">Name</font> :-: <?php echo $row_Recordset1['user']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Position</font> :-: <?php echo $row_Recordset1['posit']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Age</font> :-: <?php echo $row_Recordset1['age']; ?></B></p>
<p><B><font color=\"#FFFFFF\">From</font> :-: <?php echo $row_Recordset1['lives']; ?></B></p>

<br>
<p><b>More about <? $user ?></B><br>
  <br>
  <b><font color=\"#FFFFFF\">About Me</font> :-: <?php echo $row_Recordset1['about']; ?></B></p>
<p><B><font color=\"#FFFFFF\">My hobbies/interests </font> :-: <?php echo $row_Recordset1['hobbies']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Profession/studying</font> :-: <?php echo $row_Recordset1['study']; ?></b><br>
  <br>
  <br>
  <strong>Some of the things <? $user ?> likes</B></strong><br>
  <br>
  <B><font color=\"#FFFFFF\">Food</font>:-:<?php echo $row_Recordset1['food']; ?> </B><br>
  <B><font color=\"#FFFFFF\">Music</font> :-: <?php echo $row_Recordset1['music']; ?></B><br>
  <B><font color=\"#FFFFFF\">TV Shows</font> :-: <?php echo $row_Recordset1['tv']; ?></b><br>
  <B><font color=\"#FFFFFF\">Movies</font> :-: <?php echo $row_Recordset1['movie']; ?> </B><br>
  <B><font color=\"#FFFFFF\">Clubs</font> :-: <?php echo $row_Recordset1['venue']; ?></B><br>
  <B><font color=\"#FFFFFF\">Restaurant</font> :-: <?php echo $row_Recordset1['rest']; ?></B><br>
  <B><font color=\"#FFFFFF\">Place</font> :-: <?php echo $row_Recordset1['place']; ?></B><br>
  <B><font color=\"#FFFFFF\">Possession</font> :-: <?php echo $row_Recordset1['poset']; ?></B><br>
</p>
</body>
</html>
<?php
break;

//CHANGING THE PROFILE:
case yes:
   if(isset($submit))
      {
         $c =mysql_connect("localhost","","") or die(mysql_error());
         $db =mysql_select_db(punk_style_to_j_com);
        mysql_query("
      UPDATE `users` SET `pw` = '$_POST[pw]',
      `name` = '$_POST[name]',
      `posit` = '$_POST[posit]',
      `lives` = '$_POST[lives]',
      `about` = '$_POST[about]',
      `study` = '$_POST[study]',
      `food` = '$_POST[food]',
      `music` = '$_POST[music]',
      `tv` = '$_POST[tv]',
      `movie` = '$_POST[movie]',
      `venue` = '$_POST[venue]',
      `rest` = '$_POST[rest]',
      `place` = '$_POST[place]',
      `poset` = '$_POST[poset]' WHERE `user` = '$_GET[user]' LIMIT 1") or die(mysql_error());
      }
   else{
      $c =mysql_connect("localhost","","") or die(mysql_error());
      $db =mysql_select_db(punk_style_to_j_com);
      $query = "SELECT * FROM users WHERE user='$user'";
      $result = mysql_query($query)  or die(mysql_error());
      $row = mysql_fetch_assoc($result);?>
      
      <form name="profile" action="http://punk-style.to-j.com/profiles/view.php?change=yes&&user=<? $user ?>&&submit=true" method"post">
      <?
      echo("username: ".$row['user']);
      echo("<br>");
      echo("password: <input type=\"text\" name=\"pw\" value='".$row['pw']."'>");
      echo("<br>");
      echo("Position".$row['posit'].">");
      echo("<br>");
      echo("Where do you live: <input type=\"text\" name=\"lives\" value='".$row['lives']."'>");
      echo("<br>");
      echo("About you: <input type=\"text\" name=\"about\" value='".$row['about']."'>");
      echo("<br>");
      echo("What ya Studying? <input type=\"text\" name=\"study\" value='".$row['study']."'>");
      echo("<br>");
      echo("Fave Food <input type=\"text\" name=\"food\" value='".$row['food']."'>");
      echo("<br>");
      echo("Fave Music Style <input type=\"text\" name=\"music\" value='".$row['music']."'>");
      echo("<br>");
      echo("Fave TV Show <input type=\"text\" name=\"tv\" value='".$row['tv']."'>");
      echo("<br>");
      echo("Fave Movie<input type=\"text\" name=\"movie\" value='".$row['movie']."'>");
      echo("<br>");
      echo("Fave Venue: (The valley will not be accepted!) <input type=\"text\" name=\"venue\" value='".$row['venue']."'>");
      echo("<br>");
      echo("Fave Restaurant - So i no where to ask you out to ;P <input type=\"text\" name=\"rest\" value='".$row['rest']."'>");
      echo("<br>");
      echo("Fave Place<input type=\"text\" name=\"place\" value='".$row['place']."'>");
      echo("<br>");
      echo("Fave Possesion<input type=\"text\" name=\"poset\" value='".$row['poset']."'>");
      echo("<input type=\"submit\" Value=\"Yo, Send Me Shichz\">");
      echo("</form>");
      }
break;
}


any help would be grateful appreciated!!

thx:
STU!

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Post by Redcircle » Thu Jul 03, 2003 1:37 pm

yuckie yuckie!! What tutorial did you steal that code from (no offense if it's yours.)

on your submit button you need to name the button.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest