Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Parse error... I'm going crazy

Codes here !

Moderators: macek, egami, gesf

Parse error... I'm going crazy

Postby Chrisbbw » Wed Oct 10, 2012 2:43 am

Hello guys,

I have this code

Code: Select all
<?php

$submit = $_POST['submit'];

if (isset($submit)) {
   mysql_query("INSERT INTO eflyers (name, date, html_source, subject_line, sent_date, resort)
      VALUES ('$_POST[eflyer-name]','$_POST[eflyer-date]','$_POST[html-source]','$_POST[subject-line]','$_POST[sent-date]','$_POST[resort]')");    ?>
   
   <div id="success">
      <p>The e-flyer has been correctly added to the database.</p>
   </div>
   
<?php } ?>


All I have in return is:


Code: Select all
Parse error: syntax error, unexpected '-', expecting ']' in ... on line 21


I don't know what to do!
Chrisbbw
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Feb 23, 2012 7:52 am

Re: Parse error... I'm going crazy

Postby egami » Wed Oct 10, 2012 8:07 am

Change your form to be underscore and not a hyphen.



ie..
eflyer-name
should be
eflyer_name


Hyphen's are No-No's in PHP variables.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron