GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Jan-2008, 23:18
Epicnicity Epicnicity is offline
New Member
 
Join Date: Jan 2008
Posts: 7
Epicnicity is on a distinguished road

Also e-mail related


I am designing a website for a Counter-Strike clan, and I have made a page for applying. I am trying to get the form on this page to be emailed to the clan leader for review. Here is what I have.

On the apply page-

<form id="application" action="scripts/mail_to.php" method="post" name="application">
<input type="hidden" name="subject_line" value="iTeam Application">


And this is scripts/mail_to.php -

<?php

$to = "someone@hotmail.com";
$subject = "Application";
$message = "<?php echo $_POST["application"]; ?>";
mail($to,$subject,$message);
echo "../thankyou.php";

?>


This is what I get -

Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/"directory" on line 5
  #2  
Old 07-Jan-2008, 18:09
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 966
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Also e-mail related


Extra quotes in the string are the problem:

Check this difference:
PHP Code:

/* your code */$message = "<?php echo $_POST["application"]; ?>"; 


...versus:
PHP Code:

/* escape other quote characters WITHIN the string */$message = "<?php echo $_POST[\"application\"]; ?>"; 


Note that this is just before line 5. With php parsing, this was a simpler find, but know that "expecting T_STRING or T_VARIABLE or T_NUM_STRING" related problems could be several lines (or more) from where the parser 'thinks' the problem actually happened.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 07-Jan-2008, 19:07
Epicnicity Epicnicity is offline
New Member
 
Join Date: Jan 2008
Posts: 7
Epicnicity is on a distinguished road

Re: Also e-mail related


Change the code to this -

<?php

$to = "souljzsniper@hotmail.com";
$subject = "Application";
$message = "<?php echo $_POST[\"application\"]; ?>";
mail($to,$subject,$message);
echo "../thankyou.php";

?>

Now I get this -

**** error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/directory on line 5
  #4  
Old 07-Jan-2008, 20:43
NHDriver4's Avatar
NHDriver4 NHDriver4 is offline
New Member
 
Join Date: Jan 2008
Location: New Hampshire, USA
Posts: 10
NHDriver4 will become famous soon enough

Re: Also e-mail related


Epicnicity, you were trying to "open php in php"... if that's right...

Anyways, try the following:

PHP Code:

<?php

$to = "souljzsniper@hotmail.com";
$subject = "Application";
$message = $_POST["application"];
mail($to,$subject,$message);
echo "../thankyou.php";

?>

  #5  
Old 07-Jan-2008, 21:28
Epicnicity Epicnicity is offline
New Member
 
Join Date: Jan 2008
Posts: 7
Epicnicity is on a distinguished road

Re: Also e-mail related


<form id="application" action="thankyou.php" method="post" name="application">
<input type="hidden" name="subject_line" value="iTeam Application">
<input type="hidden" name="order" value="namecheck,name,gamenamecheck,gamename,agech eck,age,emailcheck,email,xfirecheck,xfire,why">
This information is only seen by the Clan leader. Please check any information you would like to not be posted on our website.
<p>Name<input type="checkbox" name="namecheck" value="nameprivate"><br />
<input type="text" name="name" value="Name" size="50"><br />
<br />
InGame Name<input type="checkbox" name="gamenamecheck" value="gamenameprivate"><br />
<input type="text" name="gamename" value="InGame Name" size="50"><br />
<br />
Age<input type="checkbox" name="agecheck" value="ageprivate"><br />
<input type="text" name="age" value="Age" size="20"><br />
<br />
E-Mail<input type="checkbox" name="emailcheck" value="emailprivate"><br />
<input type="text" name="email" value="E-Mail" size="50"><br />
<br />
X-Fire<input type="checkbox" name="xfirecheck" value="xfireprivate"><br />
<input type="text" name="xfire" value="X-Fire" size="50"><br />
<br />
Why would you like to join iTeam?<br />
<textarea name="why" rows="4" cols="48"></textarea><br />
<br />
<div align="center"><input type="submit" value="Submit" name="submitButtonName">&nbsp;&nbsp;&nbsp;<input type="reset"></div>
</p>
</form>


<?php

$to = "souljzsniper@hotmail.com";
$subject = "Application";
$message = $_POST["namecheck,name,gamenamecheck,gamename,agecheck,ag e,emailcheck,email,xfirecheck,xfire,why"];
mail($to,$subject,$message);
echo "../thankyou.php";

?>


Thanks for the help. Now the email sends but its blank. "application" didnt work so I tried the above.
  #6  
Old 07-Jan-2008, 22:55
NHDriver4's Avatar
NHDriver4 NHDriver4 is offline
New Member
 
Join Date: Jan 2008
Location: New Hampshire, USA
Posts: 10
NHDriver4 will become famous soon enough

Re: Also e-mail related


You can't call all the post values at the same time:

PHP Code:

<?php

$to = "souljzsniper@hotmail.com";
$subject = "Application for " . $_POST["name"];

$message = 
"Name: " . $_POST["name"] . "\n
Namecheck: " . $_POST["namecheck"] . "\n

InGame Name: " . $_POST["gamename"] . "\n
Gamecheck: " . $_POST["gamecheck"] . "\n

Age: " . $_POST["age"] . "\n
Agecheck: " . $_POST["agecheck"] . "\n

Email: " . $_POST["email"] . "\n
Emailcheck: " . $_POST["emailcheck"] . "\n

X-Fire: " . $_POST["xfire"] . "\n
X-Firecheck: " . $_POST["xfirecheck"] . "\n

Why: " . $_POST["why"] . "\n";

mail($to,$subject,$message);
echo "../thankyou.php";

?>


I've added the "\n" after each line. That causes a line break, so that the contents aren't all on one line.
Last edited by NHDriver4 : 07-Jan-2008 at 23:24. Reason: Updated Code
  #7  
Old 08-Jan-2008, 13:18
Epicnicity Epicnicity is offline
New Member
 
Join Date: Jan 2008
Posts: 7
Epicnicity is on a distinguished road

Re: Also e-mail related


Okay I'm hopless...

The email sends just fine now but all that is in the content is

Name:
  #8  
Old 08-Jan-2008, 14:02
NHDriver4's Avatar
NHDriver4 NHDriver4 is offline
New Member
 
Join Date: Jan 2008
Location: New Hampshire, USA
Posts: 10
NHDriver4 will become famous soon enough

Re: Also e-mail related


Here is the complete page, self sufficient. (Meaning upload, and point people to it)

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php if (!isset($_POST['namecheck'])) { ?> <form id="application" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="application"> <input type="hidden" name="subject_line" value="iTeam Application"> This information is only seen by the Clan leader. Please check any information you would like to not be posted on our website. <p>Name<input type="checkbox" name="namecheck" value="nameprivate"><br /> <input type="text" name="name" value="Name" size="50"><br /> <br /> InGame Name<input type="checkbox" name="gamenamecheck" value="gamenameprivate"><br /> <input type="text" name="gamename" value="InGame Name" size="50"><br /> <br /> Age<input type="checkbox" name="agecheck" value="ageprivate"><br /> <input type="text" name="age" value="Age" size="20"><br /> <br /> E-Mail<input type="checkbox" name="emailcheck" value="emailprivate"><br /> <input type="text" name="email" value="E-Mail" size="50"><br /> <br /> X-Fire<input type="checkbox" name="xfirecheck" value="xfireprivate"><br /> <input type="text" name="xfire" value="X-Fire" size="50"><br /> <br /> Why would you like to join iTeam?<br /> <textarea name="why" rows="4" cols="48"></textarea><br /> <br /> <div align="center"><input type="submit" value="Submit" name="submitButtonName">&nbsp;&nbsp;&nbsp;<input type="reset"></div> </p> </form> <?php } else { $to = "souljzsniper@hotmail.com"; $subject = $_POST["subject_line"] . " - " . $_POST["name"]; $message = "Name: " . $_POST["name"] . "\n Namecheck: " . $_POST["namecheck"] . "\n InGame Name: " . $_POST["gamename"] . "\n Gamecheck: " . $_POST["gamenamecheck"] . "\n Age: " . $_POST["age"] . "\n Agecheck: " . $_POST["agecheck"] . "\n Email: " . $_POST["email"] . "\n Emailcheck: " . $_POST["emailcheck"] . "\n X-Fire: " . $_POST["xfire"] . "\n X-Firecheck: " . $_POST["xfirecheck"] . "\n Why: " . $_POST["why"] . "\n"; mail($to,$subject,$message); echo "Thanks for your application " . $_POST["name"]; } ?> </body> </html>
  #9  
Old 08-Jan-2008, 14:06
NHDriver4's Avatar
NHDriver4 NHDriver4 is offline
New Member
 
Join Date: Jan 2008
Location: New Hampshire, USA
Posts: 10
NHDriver4 will become famous soon enough

Re: Also e-mail related


Oh, and P.S. let your leader know I just sent an application by mistake.. hah!
  #10  
Old 08-Jan-2008, 15:16
Epicnicity Epicnicity is offline
New Member
 
Join Date: Jan 2008
Posts: 7
Epicnicity is on a distinguished road

Re: Also e-mail related


Thank you so much and sorry for all the trouble.
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 2) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for link exchange partners: webmaster related website metamorph Webmaster / Web Designing Advertisements & Offers 0 12-Nov-2007 00:22
Halloween Doubles All Hosting Features- Come and See! fcolor Web Hosting Advertisements & Offers 0 23-Oct-2007 08:23
Mail Form in DreamWeaver CallFaheem2 Web Design Forum 6 12-Dec-2006 00:45
Looking For finance related only seoexpert-hyd Member Announcements, Advertisements & Offers 0 10-Mar-2006 04:46
E Mail Forwarding nikkotash Computer Software Forum - Windows 3 30-Jun-2003 03:20

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:17.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.