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
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.