Jump to content

[SOLVED] unexpected T_string


gevo12321

Recommended Posts

hi

im trying to make a form where it already has default input values and i have this code

 

<?php

include 'connect.php';

$query = mysql_query("SELECT button1 FROM layout WHERE page = 'home'") or die(mysql_error());

list($button1) = mysql_fetch_row($query);

echo "<form action="test.php" method="post"> Button 1: <input type="text" name="button1" value="$button1"/>";

mysql_close($link)

?>

 

but it gives me

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/g/e/v/gevo12321/html/test/form.php on line 5

 

please help me with this

 

im completely new to php

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/55844-solved-unexpected-t_string/
Share on other sites

First off, you are not escaping your characters.

 

Change this:

<?php

echo "<form action="test.php" method="post"> Button 1: <input type="text" name="button1" value="$button1"/>
";

?>

 

To:

<?php

echo "<form action=\"test.php\" method=\"post\"> Button 1: <input type=\"text\" name=\"button1\" value=\"$button1\"/>
";

?>

 

Then you are not ending your statement at the end.

 

Change this:

mysql_close($link)

 

To:

mysql_close($link);

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.