Jump to content

Recommended Posts

$vv2='variable2<input type="text" name="vars2" size="30" value="<?php
echo htmlspecialchars($var2 ); ?>"> ';

Please tell me what is wrong with this code, actually i want to save the value of $var2 in mysql db,but the above code is saving "<?php echo htmlspecialchars($var2 ); ?>"  into mysql db.

I appreciate your help.

Thanks,


What's wrong with the "code" you posted is that - as posted - all it does is try to set the variable $vv2 to a rather odd string. The other oddity is that the embedded input has the name vars2 but tries to echo the value of var2 acquired from who knows where.

On balance, I think we need to know a bit more about the code if we're to provide constructive help.
Remove the PHP tags as you are already in php mode:

[code=php:0]$vv2 = 'variable2<input type="text" name="vars2" size="30" value="' . htmlspecialchars($var2) . '">';[/code]


If you want to add a variable to a string use the concatenation operator (.)

Is that what you want?
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.