PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 1:26 am
I get "Parse error: parse error in /www/n/naild/htdocs/localmm/modules/Band_List/submit.php on line 23"
And i dont understand why. Heres my code for both the form and the action.
submitaband.php
Code: Select all
<?
if(!eregi("modules.php", $_SERVERї'PHP_SELF'])){
die("You can't access this file directly...");
}
$module_name = basename(dirname(__FILE__));
$module_dir = "modules/$module_name/";
include("header.php");
$index = 1;//right sidebar or not 0=off 1=on
title("Submit a band");
OpenTable();
?>
<FORM ACTION="http://naild.com/localmm/modules.php?name=Band_List&file=submit" METHOD="POST">
Band Name:<br>
<input type="text" name="band_name"size=20><br>
Description:<br>
<textarea cols=65 rows=10 name="description"></textarea><br>
History:<br>
<textarea cols=65 rows=10 name="history"></textarea><br>
Influences:<br>
<input type="text" name="influences"size=65><br>
Select Genra:<br>
<select name="genra" size=20 multiple><br>
<option>Acoustic
<option>Alternative
<option>Blues
<option>Christian
<option>Classic Rock
<option>Classical
<option>Country
<option>Cover Bands
<option>Death Metal
<option>Disc Jockey
<option>Easy Listening
<option>Electronic
<option>Emo
<option>Experimental
<option>Folk
<option>Funk
<option>Gospel
<option>Gothic
<option>Grunge
<option>Hardcore
<option>Hip Hop
<option>Instrumental
<option>Jazz
<option>Metal
<option>Modern Rock
<option>Progressive
<option>Punk
<option>Rap
<option>Reggae
<option>Rock
<option>Speed Metal
<option>Swing
<option>Techno
</select>
<br>
Email:<br>
<input type="text" name="email"size=20><br>
Website:<br>
<input type="text" name="website"size=20><br>
<input type="submit" name="submit" value="submit">
</form>
<?php
CloseTable();
include("footer.php");
?>
Submit.php
Code: Select all
<?
//MySQL Variables
$host = "host";
$login_name = "user";
$password = "pass";
//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");
//Select the database
MySQL_select_db("bandsandmembers") or die("Could not select database");
//Assign contents of form to variables
$bandname = $_POSTї'band_name'];
$description = $_POSTї'description'];
$history = $_POSTї'history'];
$influences = $_POSTї'influences'];
$genra = $_POSTї'genra'];
$email = $_POSTї'email'];
$website = $_POSTї'website'];
$sql = "INSERT INTO nuke_bands FROM bandsandmembers SET
band_name = "$bandname", // THIS IS LINE 23
description = "$description"
history = "$history"
influences = "$influences"
genra = "$genra"
Email = "$email"
website = "$website"
");
$result = mysql_query($sql);
//Code to check if statement executed properly and display a page
if ($result) {
header("Location: http://naild.com/localmm/modules.php?name=Band_List&file=sent");
} else {
echo("An error has occured");
}
//Close connection with MySQL
MySQL_close()
?>
Last edited by
mikegotnaild on Mon Feb 16, 2004 3:24 am, edited 2 times in total.
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Mon Feb 16, 2004 2:49 am
Code: Select all
//Select the database
MySQL_select_db("bandsandmembers") or die("Could not select database"
//Assign contents of form to variables
$bandname = $_POSTї'band_name']; // THIS IS LINE 14
Missing semi-colon on line 12... where you are selecting the database.
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 3:06 am
Now im getting a new error on line 23
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 3:18 am
Should i be doing this
Code: Select all
$sql = "INSERT INTO nuke_bands FROM bandsandmembers (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','#email','$website')");
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Mon Feb 16, 2004 3:24 am
sql = "INSERT INTO nuke_bands (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','$email','$website')";
Not sure what the 'FROM bandsandmembers' bit was trying to do
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 3:30 am
im still getting an error on that line though
$sql = "INSERT INTO nuke_bands (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','$email','$website')";
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 3:32 am
YAY my FIRST working data submission into mysql!
mikegotnaild
Forum Contributor
Posts: 173 Joined: Sat Feb 14, 2004 5:59 pm
Post
by mikegotnaild » Mon Feb 16, 2004 3:41 am
i got ONE tiny problem with this. When i test my form and submit it. All information is recorded correctly to the database Except for email. In phpmyadmin under the Column Email. It shows #Email and not the correct information. What is making this happen?
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Mon Feb 16, 2004 6:21 am
Cause you left in the #email (in the INSERT query) instead of $email as i'd corrected?