Page 1 of 2
How do i put the "" in PHP
Posted: Sat Oct 25, 2003 4:03 am
by William
[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.
Posted: Sat Oct 25, 2003 4:07 am
by volka
could you please post your code?
Deleated
Posted: Sat Oct 25, 2003 4:10 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Deleated
Posted: Sat Oct 25, 2003 4:13 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Posted: Sat Oct 25, 2003 4:18 am
by JAM
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 />";
?>
Deleated
Posted: Sat Oct 25, 2003 4:21 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Deleated
Posted: Sat Oct 25, 2003 4:25 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Posted: Sat Oct 25, 2003 4:31 am
by JAM
'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:
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
}
?>
Deleated
Posted: Sat Oct 25, 2003 4:34 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Posted: Sat Oct 25, 2003 4:34 am
by mikeb
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)
hehe
Posted: Sat Oct 25, 2003 4:36 am
by William
Yah im a nooby to lol i have done lots butr im a noob wel thanks have aim?
Posted: Sat Oct 25, 2003 4:37 am
by mikeb
p.s. Using the \ character before another character is called 'Escaping' a character
Deleated
Posted: Sat Oct 25, 2003 4:39 am
by William
his Has Been Deleated Because It Is No Longer Needed.
Re: So i
Posted: Sat Oct 25, 2003 4:47 am
by JAM
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") . "" />";
?>
Posted: Sat Oct 25, 2003 4:49 am
by volka
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.
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';
}
?>