Cod: Selectaţi tot
<?php
session_start();
if (!isset($_SESSION['id'])) {
echo 'Please <a href="login.php">log in</a> to access your account';
exit();
}
include_once "connect_to_mysql.php";
$id = $_SESSION['id'];
if ($_POST['state']) {
$country = $_POST['country'];
$state = $_POST['state'];
$city = $_POST['city'];
$bio = $_POST['bio'];
$sql = mysql_query("UPDATE members SET country='$country', state='$state', city='$city', bio='$bio' WHERE id='$id'");
echo 'Your account info has been updated, visitors to your profile will now see the new info.<br /><br />
To return to your profile edit area, <a href="member_account.php">click here</a>';
exit();
}
?>
<?php
$sql = mysql_query("SELECT * FROM members WHERE id='$id' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$country = $row["country"];
$state = $row["state"];
$city = $row["city"];
$accounttype = $row["accounttype"];
$bio = $row["bio"];
}
?>
Cod: Selectaţi tot
<script type="text/javascript">
<!-- Form Validation -->
function validate_form ( ) {
valid = true;
if ( document.form.country.value == "" ) {
alert ( "State must not be blank." );
valid = false;
}
if ( document.form.state.value == "" ) {
alert ( "State must not be blank." );
valid = false;
}
if ( document.form.city.value == "" ) {
alert ( "City must not be blank." );
valid = false;
}
return valid;
}
<!-- Form Validation -->
</script>
<style type="text/css">
<!--
.style1 {color: #CC0000}
.style2 {color: #000000; font-weight: bold; font-size: 18px; }
-->
</style>
</head>
<body>
<?php
include "header.php";
?>
<table width="950" height="790" border="1" align="center" bordercolor="#00FFFF" background="style/backgroundd.JPG">
<tr>
<td width="180" valign="top"><table width="180" height="27" border="0" align="center" bgcolor="#CC0033">
<tr>
<td valign="top" bgcolor="#CC0000"><div align="center" class="style2">CATEGORII </div></td>
</tr>
</table>
<table width="180" height="233" border="0">
<tr>
<td valign="top"><div align="center"><a href="categorie.php?id=Afaceri" class="btn_mediumwhite">Afaceri </a></div>
<div align="center"><a href="categorie.php?id=Articole" class="btn_mediumwhite">Articole </a></div>
<div align="center"><a href="categorie.php?id=Animale" class="btn_mediumwhite">Animale </a></div>
<div align="center"><a href="categorie.php?id=Anticariat" class="btn_mediumwhite">Anticariat</a></div>
<div align="center"><a href="categorie.php?id=Arta-Antichitati" class="btn_mediumwhite">Arta si Antichitati </a></div>
<div align="center"><a href="categorie.php?id=Auto" class="btn_mediumwhite">Auto</a></div>
<div align="center"><a href="categorie.php?id=Calculatoare" class="btn_mediumwhite">Calculatoare </a></div>
<div align="center"><a href="categorie.php?id=Colectii" class="btn_mediumwhite">Colectii</a></div>
<div align="center"><a href="categorie.php?id=Constructii" class="btn_mediumwhite">Constructii</a></div>
<div align="center"><a href="categorie.php?id=Diverse" class="btn_mediumwhite">Diverse</a></div>
<div align="center"><a href="categorie.php?id=Donatii" class="btn_mediumwhite">Donatii</a></div>
<div align="center"><a href="categorie.php?id=Electrice" class="btn_mediumwhite">Electrice</a></div>
<div align="center"><a href="categorie.php?id=Foto" class="btn_mediumwhite">Foto </a></div>
<div align="center"><a href="categorie.php?id=Hobby" class="btn_mediumwhite">Hobby</a></div>
<div align="center"><a href="categorie.php?id=Imobiliare" class="btn_mediumwhite">Imobiliare </a></div>
<div align="center"><a href="categorie.php?id=Locuri-de-munca" class="btn_mediumwhite">Locuri de munca </a></div>
<div align="center"><a href="categorie.php?id=Moda" class="btn_mediumwhite">Moda </a></div>
<div align="center"><a href="categorie.php?id=Mobilier" class="btn_mediumwhite">Mobilier </a></div>
<div align="center"><a href="categorie.php?id=Moto-Velo" class="btn_mediumwhite">Moto-Velo</a></div>
<div align="center"><a href="categorie.php?id=Media-Publicitate" class="btn_mediumwhite">Media/Publicitate </a></div>
<div align="center"><a href="categorie.php?id=Muzica" class="btn_mediumwhite">Muzica </a></div>
<div align="center"><a href="categorie.php?id=Pierderi-Gasiri" class="btn_mediumwhite">Pierderi si gasiri </a></div>
<div align="center"><a href="categorie.php?id=Servicii" class="btn_mediumwhite">Servicii </a></div>
<div align="center"><a href="categorie.php?id=Sport" class="btn_mediumwhite">Sport </a></div>
<div align="center"><a href="categorie.php?id=Turism" class="btn_mediumwhite">Turism </a></div>
<div align="center"><a href="categorie.php?id=Telefoane" class="btn_mediumwhite">Telefoane </a></div></td>
</tr>
</table>
<table width="180" height="27" border="0" align="center" bgcolor="#CC0033">
<tr>
<td valign="top" bgcolor="#CC0000"><div align="center" class="style2">ALTE ANUNTURI </div></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p></td>
<td width="568" valign="top"><div align="center">
<h3>Editati informatiile contului dumneavoastra. <br />
<br />
</h3>
</div>
<table align="center" cellpadding="8" cellspacing="8">
<form action="edit_info.php" method="post" enctype="multipart/form-data" name="form" id="form" onsubmit="return validate_form ( );">
<tr>
<td>Tara:</td>
<td><select name="country">
<option value="<?php echo "$country"; ?>"><?php echo "$country"; ?></option>
<option value="Australia">Australia</option>
<option value="Canada">Canada</option>
<option value="Mexico">Mexico</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="Zimbabwe">Zimbabwe</option>
</select></td>
</tr>
<tr>
<td><div align="right">Judet:</div></td>
<td><input name="state" type="text" id="state" value="<?php echo "$state"; ?>" size="30" maxlength="64" /></td>
</tr>
<tr>
<td><div align="right">Oras:</div></td>
<td><input name="city" type="text" id="city" value="<?php echo "$city"; ?>" size="30" maxlength="24" /></td>
</tr>
<tr>
<td class="style7"><div align="right">Despre:</div></td>
<td><textarea name="bio" cols="42" rows="8" id="bio"><?php echo "$bio"; ?></textarea></td>
</tr>
<tr>
<td> </td>
<td><input name="Submit" type="submit" value="Schimba informatii" /></td>
</tr>
</form>
unde ar putea fi problema?
Multumesc