Jump to content

Change Characters in a variable


alexville

Recommended Posts

I want people to be able to input data into my website say, maybe from YouTube.

 

Here is the data:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ECM9N7jrA0o"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ECM9N7jrA0o" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

 

I have to make this code work in PHP, not HTML.

Link to comment
Share on other sites

If I did this code:

<?
echo "<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ECM9N7jrA0o"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ECM9N7jrA0o" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>";
?>

 

It wouldn't work because of the quotes.

Link to comment
Share on other sites

<?
echo '<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ECM9N7jrA0o"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ECM9N7jrA0o" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
?>

or

<?
echo "<p><object width=\"425\" height=\"350\">...</object>';
?>

Link to comment
Share on other sites

I can't get it to work with a variable. This is my code:

 

<?
$text = $_POST['text'];

echo '$text';

?>

 

The user inputs this :

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/ECM9N7jrA0o"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ECM9N7jrA0o" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

 

And this is what comes out of it:

 

$text

Link to comment
Share on other sites

I still can't get it to work. Can someone help me fix this code, so that the video will show?

 

-- TEST1.PHP

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<form name="form1" method="post" action="test2.php">
  <p>
    <input name="text" type="text" id="text">
</p>
  <p>
    <input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>

 

--- text2.php

 

<? 
/* Include Files *********************/
session_start(); 
include("database.php");
include("login.php");
/*************************************/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<?
$text = $_POST['text'];

echo addslashes($text);

?>
</body>
</html>

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.