Current location: Hot Scripts Forums » Programming Languages » PHP » Newbie PHP problem ^^;


Newbie PHP problem ^^;

Reply
  #1 (permalink)  
Old 03-08-07, 01:11 AM
Xestrix Xestrix is offline
New Member
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Newbie PHP problem ^^;

This is whatt I'm getting. I'm not exactly sure when to use ['], ["], [\] or when things need escaped, etc. So I'm assuming I've just messed up a quote or something simple like that. I have tried shifting things around a bit but nothing seems to fix it.

Parse error: syntax error, unexpected T_VARIABLE

$msg .= "<b>New E-Mail:</b> "$_POST[new email]"<br>\n";
Reply With Quote
  #2 (permalink)  
Old 03-08-07, 01:47 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
I am assuming you have an <input> that has been submitted, named "email".
PHP Code:

$msg .= "<b>New E-Mail:</b> ".$_POST["email"]."<br>\n"
__________________
Jerry Broughton
Reply With Quote
  #3 (permalink)  
Old 03-08-07, 04:43 PM
Xestrix Xestrix is offline
New Member
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Well I have an input named email, but I also have an inut named "new email", which is what that field was for. Is there a problem with spaces in input names? I'm not quite sure why I had a space though, I generally use an underscore.
Reply With Quote
  #4 (permalink)  
Old 03-08-07, 05:05 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Yes you can have a input name with spaces. (best not to)
To grab the fields data after submiting you use this: $_POST["new email"] ;


This is a command that will turn all POSTED information into variables:
Just another helpful command. For this one you do need underscores.
PHP Code:

extract($_POST) ;


echo 
$new_email 

Last edited by phpdoctor; 03-08-07 at 05:07 PM. Reason: mistake
Reply With Quote
  #5 (permalink)  
Old 03-08-07, 05:46 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
That's a cool trick. I'm going to have to write that one down on paper. Thank-you phpdoctor.
__________________
Jerry Broughton
Reply With Quote
  #6 (permalink)  
Old 03-08-07, 05:48 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You can also use import_request_variables().
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can someone help with htaccess and php problem tigherrdk PHP 6 03-09-09 02:28 AM
Newbie found a solution to a date problem. mickey_kamer Perl 4 05-09-07 05:54 AM
PHP and JavaScript problem twome PHP 1 04-19-06 06:43 PM
PHP Windows 2003 Problem - Help Please dwdviper PHP 1 04-19-06 01:39 PM
.htaccess and PHP Redirect problem dodod PHP 3 06-19-05 10:56 PM


All times are GMT -5. The time now is 05:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.