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

Link to comment
Share on other sites

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.