Jump to content

Please help me with the following php coding


mga

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,


Link to comment
Share on other sites

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.
Link to comment
Share on other sites

The value of $var2 will be html/url string, i thought to use funcation "htmlspecialchars" 
i have to use the php tag. if you have any sample code to store the html and url values
in mysql db,could you please send to me.

Thanks,
Link to comment
Share on other sites

Actually i want to store the htmlspecialchars value of $var2  into the variable $vv2,
for that i used value="<?php echo htmlspecialchars($var2 ); ?>"

if the above is not correct,could you please let me know the syntax for that.

Thanks,
Link to comment
Share on other sites

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