Jump to content

Recommended Posts

hi all

here is my code...

  <?php
      echo "<input name="."button"." type="."submit"." class="."formbutton"." id="."button"." value="."Submit 1"." />";
  ?>

 

problem is, i want to display the value of button is Submit space 1 like  "Submit 1",  but it is display only "Submit" value

and blank space and 1 are not display..

 

someone help me please....

thanks

shahid hussnain

Link to comment
https://forums.phpfreaks.com/topic/227894-want-space-in-button-value/
Share on other sites

It is simple, your code isn't producing any 'quotation marks' (look at the html source).

 

You can escape them:

<?php
echo "<input name= \"button\" type=\"submit\"  value=\"Submit 1\" />";
?>

 

or use single quotes:

 

<?php
echo "<input name= 'button' type='submit'  value='Submit 1' />";
?>

how would you use the single quote method in strings that already have single quotes?  For example using php and javascript the following way would not work with single quotes because you already have single quotes in the string:

 

echo "<a href=\"popup.php\" onMouseOver=\"window.name='main'\" onClick=\"return popup(this, 'notes')\">Click Here</a>";

 

Any suggestions?

Like this?:

 

echo "<a href='popup.php' onMouseOver='window.name=\'main\'' onClick='return popup(this, \'notes\')'>Click Here</a>";

 

Is this correct?

 

Or would it be like this?:

 

echo "<a href=\'popup.php\' onMouseOver=\'window.name='main'\' onClick=\'return popup(this, 'notes')\'>Click Here</a>";

All you have to do is escape quotes that are the same type as the ones that enclose the string. If it's a single quoted string, any single quotes within it would need to be escaped, likewise for double quotes.

For this:

 

<a href="pwordhelp.php" onMouseOver="window.name = 'main'" onClick="return pwpopup(this, 'notes')>Click</a>

 

I tried this:

 

echo "<a href='pwordhelp.php' onMouseOver='window.name = \'main\' ' onClick='return pwpopup(this, \'notes\')'>Click</a>";

 

and this:

 

echo "<a href=\'pwordhelp.php\' onMouseOver=\'window.name = 'main'\' onClick=\'return pwpopup(this, 'notes')\'>Click</a>";

 

neither of them worked... oh well, guess I'm sticking with double quotes :-)

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.