Code: Select all
<input type="hidden" name="validuser" value="<?$_SESSION['valid_user']"?>Moderator: General Moderators
Code: Select all
<input type="hidden" name="validuser" value="<?$_SESSION['valid_user']"?>Code: Select all
<input type="hidden" name="validuser" value="<? $_SESSION['valid_user']; ?>">Code: Select all
<input type="hidden" name="validuser" value="<? $_SESSION['valid_user']; ?>">Code: Select all
<input type="hidden" name="validuser" value="<? echo $_SESSION['valid_user']; ?>">Code: Select all
<input type="hidden" name="validuser" value="<?= $_SESSION['valid_user']; ?>">Code: Select all
><input type="text" name=<?"description ' . $n . '"?> style="width: 175px">Code: Select all
<input type="text" name="<? echo 'description' . $n; ?>" style="width: 175px">Code: Select all
><input type="text" name="<? echo 'description'.$n; ?>" style="width: 175px">Code: Select all
$member = $_POST[echo 'description'.$n;];Code: Select all
$member = $_POST['description'.$n;];Code: Select all
$member = $_POST["description$n"];Both are syntactically wrong. The second is almost correct apart from the semi colon in the [ ].PHP_Ste wrote:Think I might have found the problem, do I have to echo when I'm assigning the form vars to normal vars?
For example:
or is it justCode: Select all
$member = $_POST[echo 'description'.$n;];
Code: Select all
$member = $_POST['description'.$n;];
Code: Select all
$member = $_POST['description'.$n];Code: Select all
<?php
session_start();
include('connect.inc');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Welcome to DIYMusic.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#666666" vlink="#666666">
<?php
$_SESSION['no_of_influences'] = $_POST['influences'];
$_SESSION['no_of_members'] = $_POST['member'];
if(isset($_POST['validuser'])) { ?>
<table width="96%" height="600" border="0">
<tr>
<td width="31%" valign="top"><img src="Register%20Side%20Bar.jpg" width="290" height="500" border="0" usemap="#Map"></td>
<div align="center"><b>Enter the details of each member of your band and each band who has influenced you below:</b></div>
<p></p>
<p><p>
<p></p>
<td width="69%" valign="top">"><p>Hello <? echo $_POST['validuser']; ?>, welcome to the backstage area! <a href="logout.php">LOG OUT</a></p>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<b><i>Members:</i></b>
<?php
$i=1;
echo'<table border="0">';
while ($i <= $_SESSION['no_of_members'])
{
**********************************************************
ERROR BELOW, on the ="<? echo 'member'.$i; ?>" line.
Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
echo'<tr>';
echo'<td width="37%"><p><strong>Member</strong></td>
<td width="63%">
<input type="text" name="<? echo 'member'.$i; ?>" style="width: 175px">
</strong></td>
</tr>';
echo'<tr>
<td><p><strong>Role: </strong></td>
<td><input type="text" name="<? echo 'role'.$i; ?>" style="width: 175px"></td>
</tr>';
echo'<tr>
<td><strong>Description</strong></td>
<td><input type="text" name="<? echo 'mdescription'.$i; ?>" style="width: 175px"></td>
</tr> ';
$i++;
}?>
<tr><td><b><i>Influences:</i></b></td></tr>
<?php
$n=1;
while ($n <= $_SESSION['no_of_influences'])
{
?>
<p><tr><td>
<strong>Influence</strong></td>
<td><input type="text" name="<? echo 'influence'.$n; ?>" style="width: 175px">
</td></tr>
<tr><td>
<strong>Description</strong></td>
<td><input type="text" name="<? echo 'description'.$n; ?>" style="width: 175px">
</td></tr>
<?
$n++;
}
$loginname = $_POST['validuser'];
$sql = "SELECT band_ID FROM user where login_name = '.$loginname.'";
$result = mysql_query($sql);
$bandID = mysql_fetch_array($result);
$i=1;
if(isset($_POST['submit'])) {
while ($i <= $_SESSION['no_of_members'])
{
$member = $_POST['description'.$i];
$role = $_POST['role'.$i];
$mdescription = $_POST['mdescription'.$i];
$sql = "INSERT INTO member (`band_ID`, `member_name`)
VALUES (
'$bandID', '$member'
)";
mysql_query($sql, $dbh) or die("Failed <pre>$sql</pre>".mysql_error());
$memberID = mysql_insert_ID();
$sql = "INSERT INTO memberrole (`member_ID`, `role`)
VALUES(
'$memberID', '$role'
)";
mysql_query($sql, $dbh) or die("Failed <pre>$sql</pre>".mysql_error());
$sql = "SELECT * FROM role WHERE role = '".$role."' && description = '".$mdescription."'";
$result = mysql_query($sql) or die("Failed <pre>$sql</pre>".mysql_error());
if (mysql_num_rows($result) <= 0 )
{
$sql = "INSERT INTO role (`role`, `description`)
VALUES(
'$role', '$description'
)";
mysql_query($sql, $dbh) or die("Failed <pre>$sql</pre>".mysql_error());
$i++;
}
$n=1;
while ($n <= $_SESSION['no_of_influences'])
{
$influence = $_POST['influence'.$n];
$description= $_POST['description'.$n];
$sql = "INSERT INTO bandinfluence (`band_ID`, `influence`)
VALUES(
'$bandID', '$influence';
)";
mysql_query($sql, $dbh) or die("Failed <pre>$sql</pre>".mysql_error());
$sql = $sql = "SELECT * FROM influence WHERE influence = '".$influence."' && description = '".$description."'";
$result = mysql_query($sql) or die("Failed <pre>$sql</pre>".mysql_error());
if (mysql_num_rows($result) <= 0 )
{
$sql = "INSERT INTO influence (`influence`, `description`)
VALUES(
'$influence', '$description'
)";
mysql_query($sql, $dbh) or die("Failed <pre>$sql</pre>".mysql_error());
$n++;
}
}
echo'Your Members and Influences are now in the database, all you need to do now is upload your mp3!';
}
}
}
?>
<tr></tr>
<tr><td></td>
<td><input type="submit" name="submit" value="Submit Details" /></td></tr>
</table>
</form>
</table>
</body>
</html>