Jump to content

php two words problem


itachi77

Recommended Posts

Hi, having a really strange problem, i have a form like this:


<form method='post' action='addcart.php'>
echo $name //prints both parts of name separated by space
<input type='hidden' value='$name' name='na'

 

and then in the addcart.php

echo $_POST['na']   //only prints first half of name

 

So for example, if $name was "Product One" when i print the value in first script it prints Product One fine but when i print in the other script it only prints "Product".  This then leads onto only half the name being copied into a database. 

I'm sure this was working fine before, not sure what the problem here is...

 

 

Link to comment
https://forums.phpfreaks.com/topic/209512-php-two-words-problem/
Share on other sites

ah sorry guys, the code i had was like this :

echo "<input type='hidden' value=".$name."name='na'/>"

 

The reason why it wasn't working was because i forgot the ' ' around the $name so like

echo "<input type='hidden' value='".$name."'name='na'/>"

really silly of me, thanks for the effort.

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.