Jump to content

html and php


Porkie

Recommended Posts

im confused with an error i get with this code

 

echo '<div id="leftalign">';
echo '<div id="style1">';
echo '[site News]'.'          '.'<a href="admin.php">Edit Details</a>'.'  '.'<a href="admin.php">Competitions</a>'.'  '.'<a href="admin.php">Contact Us</a>';;
echo '</div>';
echo '<hr>';
echo '<form method="post" enctype="multipart/form-data">;
<br />;
Password:                <input type="text" name="password" value="<?php echo $stuff['password']; ?>" /><br /><br />;
Email:                      <input type="email" name="email" value="<?php echo $stuff['email']; ?>"  /><br /><br />;
Membership Type:     <select name="type">
<option value="Music Enthusiast">Music Enthusiast</option>
    <option value="Band Member"<?php if ($stuff['type'] == 'Band Member') { echo ' Selected="selected"'; } ?>>Band Member</option>
</select><br /><br />';

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/myuklive/public_html/test3.php on line 96

 

line 96 being,

 

Password:                <input type="text" name="password" value="<?php echo $stuff['password']; ?>" /><br /><br />;

 

any help is appreciated :D

 

regards

Link to comment
https://forums.phpfreaks.com/topic/173327-html-and-php/
Share on other sites

You cannot place PHP tags within an echo statement

echo '<form method="post" enctype="multipart/form-data">;
<br />;
Password:                <input type="text" name="password" value="<?php echo $stuff['password']; ?>" /><br /><br />;
Email:                      <input type="email" name="email" value="<?php echo $stuff['email']; ?>"  /><br /><br />;
Membership Type:     <select name="type">
   <option value="Music Enthusiast">Music Enthusiast</option>
    <option value="Band Member"<?php if ($stuff['type'] == 'Band Member') { echo ' Selected="selected"'; } ?>>Band Member</option>
</select><br /><br />';

 

The above should be coded as

 

echo '<form method="post" enctype="multipart/form-data">;
<br />;
Password:                <input type="text" name="password" value="' . $stuff['password'] . '" /><br /><br />;
Email:                      <input type="email" name="email" value="' . $stuff['email'] . '"  /><br /><br />;
Membership Type:     <select name="type">
   <option value="Music Enthusiast">Music Enthusiast</option>
    <option value="Band Member"' . (($stuff['type'] == 'Band Member') ? ' Selected="selected"' : null) . '>Band Member</option>
</select><br /><br />';

Link to comment
https://forums.phpfreaks.com/topic/173327-html-and-php/#findComment-913694
Share on other sites

echo '<form method="post" enctype="multipart/form-data">;

<br />;

 

Should be

 

echo '<form method="post" enctype="multipart/form-data">

<br />';

 

You really need to check that code over.  Are you meaning to exit out of php after line 94? if so you will need to change all lines afterwards as HTML does not use ; to close.

Link to comment
https://forums.phpfreaks.com/topic/173327-html-and-php/#findComment-913695
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.