Jump to content

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);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.