How do i put the "" in PHP
Moderator: General Moderators
How do i put the "" in PHP
[admin edit: topic has been locked because OP deleted all the text of their posts]
Note to other users from twigletmac:
Deleting all your questions and follow-ups from a thread is unfair to those who helped you because the next time someone has a similar question they will have to post again as a search cannot show up deleted text. Therefore those who helped have to start again.
his Has Been Deleated Because It Is No Longer Needed.
Note to other users from twigletmac:
Deleting all your questions and follow-ups from a thread is unfair to those who helped you because the next time someone has a similar question they will have to post again as a search cannot show up deleted text. Therefore those who helped have to start again.
his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:11 am, edited 2 times in total.
Perhaps this will give you some ideas to what you have done bad. If you use quotes within quotes you need to escape them using a backslash.
Code: Select all
<?php
// First example, using single quotes... \ not needed in this case
echo 'Text containing " here, and '. date("F j Y") .' a date...<br />';
// Second example, using double quotes...
echo "Text containing " here, and ". date("F j Y") ." a date...<br />";
?>'TEXT' . date() . ' TEXT'
I'm exiting plain text output, to run the date() function, then re-enter plain text output.
In your case however I would do the following:
I'm exiting plain text output, to run the date() function, then re-enter plain text output.
In your case however I would do the following:
Code: Select all
<?php
$something = $foo = 'foo'; // example to get some data in variables
if ($something == $foo) {
// now we drop php entirely
?>
<html>
<body>
...<br />
Date is: <?php echo date("F j Y"); ?><br />
<input type="text" name="date" value="<?php echo date("F j Y"); ?>" /><br />
...<br />
</body>
</html>
<?php
// need to add the } to match the if clause above
}
?>When you are using double quotes, example " within a string of text to be output, you must put the \ character before it, so I think your sample below...
Echo " Welcome To Logged In Area <input type=hidden name=date value='.date("somthing").'";
...should look like this...
Echo " Welcome To Logged In Area <input type=\"hidden\" name=\"date\" value=\"whatever\"";
I think the main point is, if you are using double quotes, put the backslash in before them. This tells php that the double quotes are not something special, but are to be treated as double quote characters to be output. Hope that helps and if you get any other help from anyone more experienced than me, take their advice (I'm a newbie myself)
Echo " Welcome To Logged In Area <input type=hidden name=date value='.date("somthing").'";
...should look like this...
Echo " Welcome To Logged In Area <input type=\"hidden\" name=\"date\" value=\"whatever\"";
I think the main point is, if you are using double quotes, put the backslash in before them. This tells php that the double quotes are not something special, but are to be treated as double quote characters to be output. Hope that helps and if you get any other help from anyone more experienced than me, take their advice (I'm a newbie myself)
Re: So i
The Hidden Viper wrote:So i do this:Code: Select all
<?php Echo " Welcome To Logged In Area <input type=hidden name=date value='.date("somthing").'"; ?> ?>
Code: Select all
<?php
echo "Welcome To Logged In Area <input type="hidden" name="date" value="" . date("F j Y") . "" />";
?>also note that you can enter/leave/re-enter php-blocks almost as you
anything outside a php block (the syntax hilighter here assigns the color black to these parts) is sent as-is.
anything outside a php block (the syntax hilighter here assigns the color black to these parts) is sent as-is.
Code: Select all
<?php if ( $user == "xxxxxxxxxxxxxx" ) { ?>
<html>
<head>
<title>Fill in the user's information.</title>
</head>
<body>
<form action="add.php" name="form" method="post">
<input type="hidden" name="date" value="<?php echo date('F j Y'); ?>" />
<div align="center">
<table cellpadding="0" cellspacing="0" border="1" bordercolor="#cccccc" width="60%">
<tr>
<td>
<br />
<center><?php echo date("F j Y"); ?></center>
[...]
<?php
} else {
echo 'Please Sign In';
}
?>
Last edited by volka on Sat Oct 25, 2003 4:54 am, edited 2 times in total.