Jump to content

[SOLVED] Creating a form with PHP, putting variable for initial value with space..how??


physaux

Recommended Posts

Ok so, let me explain what the problem is.

Its easier if i just show you the code:

<?php
$initialvalue= "bob smith";
//Several lines later...
echo '<form action="" method="post">';
echo " YourName: <input type='text' name='newname' value=".$initialvalue." /><br>";
echo '<input type="submit" name="submit" value="Proceed" /></form>';
?>

 

When i run this code, only bob comes out, and not bob smith, in the text box as the default value

 

Anyone see a problem  :confused:? How can i make this work?

 

THanks!!

and just to point something else out quick, stay consistent with your quotes, ie. first line you used single-quotes, second line double-quotes, then back to single-quotes .. will cause yourself some serious headaches.

 

that is all.

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.