Jump to content

Probably simple but kinda baffled


Phpfr3ak

Recommended Posts

The alias form isn't being read for some reason, with having $alias = $_POST['alias']; i don't quiet understand why this isn't it isn't being picked up as a variable below, any clues? cheers

<?php include("header.php"); 
if(isset($_POST['formAlias']) &&
$_POST['formAlias'] == 'Yes') 
{
$alias = $_POST['alias'];
$alias = preg_replace("/[^a-zA-Z0-9_]/", "", $alias);
$namelength = strlen($alias);
if($namelength < 3){
$error1="Your alias must be at least 3 characters!</span></div>";
echo $error1;
}else{
}	
$query = sprintf("SELECT COUNT(id) FROM players WHERE UPPER(alias) = UPPER('$alias')",
mysql_real_escape_string($alias));
$result = mysql_query($query);
list($count) = mysql_fetch_row($result);
if($count >= 1) { 
$error1="$alias is already taken.";
echo $error1;
}else{
}
$sql = "updatehereble";
mysql_query($sql) or die(mysql_error());
}else{
}
?>
</p>
<p>
<input name="alias" type="text" id="alias">
</p>
<form action="alias.php" method="post">
Do you wish to use an alias?
  <input type="checkbox" name="formAlias" value="Yes" />
<input type="submit" name="formSubmit" value="Submit" />
</form>

Link to comment
https://forums.phpfreaks.com/topic/253802-probably-simple-but-kinda-baffled/
Share on other sites

put

 

<input name="alias" type="text" id="alias">

 

inside your form tags as the form submit will only send the values within your form e.g.

 

<form action="alias.php" method="post">
<p>
<input name="alias" type="text" id="alias">
</p>
Do you wish to use an alias?
  <input type="checkbox" name="formAlias" value="Yes" />
<input type="submit" name="formSubmit" value="Submit" />
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.