How do i put the "" in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

How do i put the "" in PHP

Post 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.
Last edited by William on Sat Oct 25, 2003 5:11 am, edited 2 times in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

could you please post your code?
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:11 am, edited 1 time in total.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:11 am, edited 1 time in total.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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 />";
?>
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:12 am, edited 1 time in total.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:12 am, edited 1 time in total.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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
 }
?>
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:12 am, edited 1 time in total.
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

Post 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)
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

hehe

Post by William »

Yah im a nooby to lol i have done lots butr im a noob wel thanks have aim?
mikeb
Forum Commoner
Posts: 60
Joined: Tue Jul 08, 2003 4:37 pm
Location: Dublin, Ireland

Post by mikeb »

p.s. Using the \ character before another character is called 'Escaping' a character
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Deleated

Post by William »

his Has Been Deleated Because It Is No Longer Needed.
Last edited by William on Sat Oct 25, 2003 5:12 am, edited 1 time in total.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Re: So i

Post 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") . "" />";
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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';
}
?>
Last edited by volka on Sat Oct 25, 2003 4:54 am, edited 2 times in total.
Locked