PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 8th, 2008, 03:44 PM
ford2008 ford2008 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 67 ford2008 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 36 sec
Reputation Power: 1
Thumbs up Problems with this code?

Heya, can anybody help me with this code,

im trying to post the $firstName variable to the page...

the error msg that comes up is :

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'


PHP Code:
echo '<div id=/"content/"> <div class=/"right/"><h2><a   href=/"/"> $_POST['$firstName']; 


thanks everybody!

Reply With Quote
  #2  
Old May 8th, 2008, 03:51 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: May 2001
Location: Ft Myers, FL
Posts: 4,003 kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)  Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115392 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 2 Weeks 4 Days 16 h 44 m 28 sec
Reputation Power: 414
Send a message via ICQ to kicken Send a message via AIM to kicken Send a message via MSN to kicken
You have problems with your quotes by trying to access the array key. Asside from that, variables are not interpreted when placed in a string enclosed in single quotes. Use either double-quotes with complex syntax, or single quotes and string concatenation.

Code:
echo '<div id="content"> <div class="right"><h2><a href="">'.$_POST['firstName'];


or

Code:
//Your slashes to escape the quotes are also wrong.  You use backslash \, not forward slash /.
echo "<div id=\"content\"> <div class=\"right\"><h2><a href=\"\">{$_POST['firstName']}"
__________________
Spidermonkey Tutorial

http://wiser.aoeex.com/ - Long term project (offline due to evil crawlers and lack of content)
http://www.aoeex.com/gmap.php - Put yourself on the map

Reply With Quote
  #3  
Old May 8th, 2008, 04:25 PM
ford2008 ford2008 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 67 ford2008 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 36 sec
Reputation Power: 1
Thumbs up cheers

cheers, problem sorted- iv got another code problem though if you could assist me,


error message:

Warning: Cannot modify header information - headers already sent by (output started at...(ive highlighted the line

Code:

PHP Code:
<?php

//session_start();

include('functions.php');

if(!isset(
$_POST['user']) OR !isset($_POST['pass']))

{echo
"<div id = \"content\">;

<div class=\"right\">;
<h2>< href=\"\">
You have entered an incorrect password
</a></h2>"
;
//return 0;

}
$user=$_POST['user'];

$pass=$_POST['pass'];

$firstName=$_POST['firstName'];

$LastName=$_POST['lastName'];

$pass2=getPass($user);

if(
md5($pass)!=$pass2)
{
echo 
"<div id=\"content\">;<div class=\"right\">;

<a href=\"\"><h2>The password you entered is not correct, please try again</h2></a>"
;

exit();

die(
'');

}

//return 0;

//echo('Login successful');
//return 1;
//$_SESSION['logged']=1;

<span class="highlight">setcookie("Logged","1");</span>

echo 
'<div id=\"content\"> <div class=\"right\"><h2><a href=\"\">';
echo 
'<div id=\"content\"> <div class=\"right\"><h2><a href=\"\">\'.$_POST[\'firstName\']';

?>


thankyou

Reply With Quote
  #4  
Old May 8th, 2008, 05:27 PM
OlyPerson OlyPerson is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 37 OlyPerson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 34 m 41 sec
Reputation Power: 1
PHP Code:
echo"<div id = \"content\">; 

<div class=\"right\">; 
<h2>< href=\"\"> 
You have entered an incorrect password 
</a></h2>"

//return 0; 

There, you have to 'echo' the last bit so use this instead.
PHP Code:
echo '<div id = "content"> 
<div class="right"> 
<h2>< href="\"> 
You have entered an incorrect password 
</a></h2>'

//return 0; 

Try reading a book on PHP or find a good tutorial, you'll learn how to write less buggy code. In two instances you forgot to add " in to echoed stuff, so in that line and in the last line.
Is that all the code? I didn't see a header in there. Remember when you use headers, the header has to be inserted before code that sends anything to the browser.

Reply With Quote
  #5  
Old May 8th, 2008, 05:58 PM
ford2008 ford2008 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 67 ford2008 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 38 m 36 sec
Reputation Power: 1
Thumbs up

cheers, for your help, yea just added a few headers recently - made sure they were b4 the code too !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problems with this code?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway