Search & Amend User Details
<p>I wonder whether someone can help me please.</p>

<p>I'm trying to put together a form and PHP script (below) which allows an administrator to search and update member details via the email address, populating a second email address, forename and surname fields with the retrieved information ready for them to be amended.</p>

<pre><code>&lt;?php 
mysql_connect ("hostname","username","password") or die (mysql_error()); 
mysql_select_db ("databasename"); 
if ($_POST['search'])
{
    $searchemailaddress = $_POST['searchemailaddress']; 
    $sql = mysql_query("select * from userdetails where emailaddress like '$searchemailaddress'"); 
    while ($row = mysql_fetch_array($sql))
    { 
        $emailaddress = $_POST['emailaddress']; 
        $forename = $row['forename']; 
        $surname = $row['surname'];
    }
elseif ($_POST[['update'])
{
    $userid = $_POST['userid']; 
    $emailaddress = $_POST['emailaddress']; 
    $forename = $_POST['forename']; 
    $surname = $_POST['surname']; 
    //replace TestTable with the name of your table 
    $sql = ("UPDATE `userdetails` SET `emailaddress` = '$emailaddress', `forename` = '$forename',`surname` = '$surname' WHERE `userdetails`.`userid` = '$userid' LIMIT 1");
}
}
}
?&gt; 
</code></pre>

<p>I'm receiving the following error:
<code>Parse error: syntax error, unexpected T_ELSEIF in /homepages/2/d333603417/htdocs/development/searchandamend.php on line 13</code></p>

<p>with line 13 being this line in my script. <code>elseif ($_POST[['update'])</code></p>

<p>Could someone perhaps take a look at this please and let me know where I'm going wrong.</p>

<p>Many thanks</p>
