Page 1 of 1

can't display and getting error

Posted: Wed Dec 31, 2008 8:46 pm
by gerbs987
Hi. I'm fairly new to PHP. I have the code below, but right now i'm getting the following error:

Parse error: syntax error, unexpected T_FUNCTION in /home/bryantr/public_html/form1.php on line 6

I've been playing around to get this going, but the best i can do is no errors, but a blank screen. Any help is greatly appreciated.

Code: Select all

<?php
$head_info = "<link href=\"adminStyle.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
@session_start();
include('./pool_body.php');
 
$content = "\n."function show_form() {." <form action=\"."echo $PHP_SELF;\". method=\"post\" name=\"forms\">
  <b><font face=\"arial\"><u>AFC</u></font></b><p>
 
    <b><font face=\"trebuchet ms\">New England Patriots:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box1\"><p>
 
    Indianapolis Colts:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box2\"><p>
 
    San Diego Chargers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box3\"><p>
 
    Pittsburgh Steelers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box4\"><p>
 
    Jacksonville Jaguars:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box5\"><p>
 
    Tennessee Titans:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box6\"><p></font></b>
 
<b><font face=\"arial\"><u>NFC</u</font></b></u><p>
 
    <b><font face=\"trebuchet ms\">Dallas Cowboys:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box7\"><p>
 
    Green Bay Packers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box8\"><p>
 
    Seattle Seahawks:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box9\"><p>
    
    Tampa Bay Buccaneers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box10\"><p>
 
    New York Giants:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box11\"><p>
 
    Washington Redskins:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box12\"><p>
 
    SCREEN NAME:<input type=\"text\" size=\"20\" maxlength=\"20\" name=\"box13\"><p>
 
    <input type=\"submit\" value=\"Submit\"></b></font>
 
</form>";
}
 
if(!isset($_POST['box1'])) {
    show_form();
    exit;
}
$subject = $_POST['box13'];
foreach($_POST as $key => $value){
    $loler[$key] = $value;
}
foreach($loler as $key => $value){
    $string .= $value."\n";
}
 
mail("pool@stvitalpool.com",$subject,$string,"from: pool@fdfsdf.com");
echo '<b><font face="trebuchet ms">Your values have been submitted for the NFL Playoffs.  Please double check all info is correct.  Values are shown in same order as shown on the main page.  Good Luck!!!<p></b></font>';
echo '<b><font face="trebuchet ms"><center>' .$string. '</center></b></font>';
 
make_page('StVitalPool.com', $head_info, $content, './images/contentBox/headers/home.png');
 
?>

Re: can't display and getting error

Posted: Wed Dec 31, 2008 9:06 pm
by omniuni
Try removing the variable before the function:

Code: Select all

$content = "\n."function show_form() {." <form action=\"."echo $PHP_SELF;\". method=\"post\" name=\"forms\">
would become

Code: Select all

function show_form() {echo " <form action=\".$_SERVER['PHP_SELF']. method=\"post\" name=\"forms\">

Re: can't display and getting error

Posted: Wed Dec 31, 2008 10:01 pm
by gerbs987
nope. that didn't help. kinda need the $content variable there in order to display the information using the make_page function at the bottom of the page.

Re: can't display and getting error

Posted: Wed Dec 31, 2008 10:05 pm
by requinix
show_form is just a string. The string doesn't change but where it gets displayed does.

Code: Select all

<?php
$head_info = "<link href=\"adminStyle.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
@session_start();
include('./pool_body.php');
 
$content = "<form action=\"".$_SERVER["SCRIPT_NAME"]."\" method=\"post\" name=\"forms\">
  <b><font face=\"arial\"><u>AFC</u></font></b><p>
 
    <b><font face=\"trebuchet ms\">New England Patriots:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box1\"><p>
 
    Indianapolis Colts:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box2\"><p>
 
    San Diego Chargers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box3\"><p>
 
    Pittsburgh Steelers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box4\"><p>
 
    Jacksonville Jaguars:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box5\"><p>
 
    Tennessee Titans:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box6\"><p></font></b>
 
<b><font face=\"arial\"><u>NFC</u</font></b></u><p>
 
    <b><font face=\"trebuchet ms\">Dallas Cowboys:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box7\"><p>
 
    Green Bay Packers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box8\"><p>
 
    Seattle Seahawks:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box9\"><p>
   
    Tampa Bay Buccaneers:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box10\"><p>
 
    New York Giants:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box11\"><p>
 
    Washington Redskins:<input type=\"text\" size=\"2\" maxlength=\"2\" name=\"box12\"><p>
 
    SCREEN NAME:<input type=\"text\" size=\"20\" maxlength=\"20\" name=\"box13\"><p>
 
    <input type=\"submit\" value=\"Submit\"></b></font>
 
</form>";
 
if(!isset($_POST['box1'])) {
    echo $content;
    exit;
}
$subject = $_POST['box13'];
foreach($_POST as $key => $value){
    $loler[$key] = $value;
}
foreach($loler as $key => $value){
    $string .= $value."\n";
}
 
mail("pool@stvitalpool.com",$subject,$string,"from: pool@fdfsdf.com");
echo '<b><font face="trebuchet ms">Your values have been submitted for the NFL Playoffs.  Please double check all info is correct.  Values are shown in same order as shown on the main page.  Good Luck!!!<p></b></font>';
echo '<b><font face="trebuchet ms"><center>' .$string. '</center></b></font>';
 
make_page('StVitalPool.com', $head_info, "\n".$content, './images/contentBox/headers/home.png');
 
?>
Made a couple other changes too.