I have a search form, where the user can insert in the same field the name of one or more authors.
I have this code:
Author<br /><input type="text" name="autore" value=<?php echo $_GET['autore'] ?> ><br/>
To automatically fill the Author field on the next page.
My problem is that if the user writes for example:
san, gli, tro
In the Author field I'll get only 'san,' , while I want 'san, gli, tro' .
How can I solve this?
What happens if you do:
Author<br /><input type="text" name="autore" value="<?php echo $_GET['autore'] ?>" ><br/>
(Notice quotes around the value attribute)
You need to put quotes around value from php. Like this:
Author<br /><input type="text" name="autore" value="<?php echo $_GET['autore'] ?>" ><br/>
In your case the final html will be
Author<br /><input type="text" name="autore" value=san gli tro ><br/>
so the value of attribute value
is san
and the other to are empty attribute names.
With quotes, the final html will be
Author<br /><input type="text" name="autore" value="san, gli, tro" ><br/>
Which is what you need.