Jump to content

imstylin1

New Members
  • Posts

    8
  • Joined

  • Last visited

imstylin1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. PFMaBiSmAd solved the issue for me. Dreamweaver was putting spaces in ending heredoc tags. Put them in column 1 and it fixed the issue.
  2. Could hitting the spacebar after one of the heredoc tags be the problem?
  3. DW didn't like $movie_name = {$row['movie_name']}; without the {} around $row['movie_name']; but the book i am learning from doesn't show them. This leads me to believe the book is missing something that is now needed for proper syntax.
  4. All the {} and () seem to be there.
  5. I'll look... thanks.
  6. I have the following code: <?php $link=mysql_connect("localhost","root","") or die (mysql_error()); mysql_select_db("moviesite") or die(mysql_error()); $query="SELECT movie_name, movie_director, movie_leadactor FROM movie"; $result=mysql_query($query, $link) or die (mysql_error()); $num_movies=mysql_num_rows($result); $movie_header=<<<EOD <h2><center>Movie Review Database</center></h2> <table width="70%" border="1" cellpadding="2" cellspacing="2" align="center"> <tr> <th>Movie Title</th> <th>Movie Director</th> <th>Movie Lead Actor</th> </tr> EOD; $movie_details=''; while ($row = mysql_fetch_array($result)) { $movie_name = {$row['movie_name']}; $movie_director = {$row['movie_director']}; $movie_leadactor={$row['movie_leadactor']}; $movie_details .=<<<EOD <tr> <td>$movie_name</td> <td>$movie_director</td> <td>$movie_leadactor</td> </tr> EOD; } $movie_details .=<<<EOD <tr> <td> </td> </tr> <tr> <td>Total :$num_movies Movies</td> </tr> EOD; $movie_footer="</table>"; $movie = <<<MOVIE $movie_header $movie_details $movie_footer MOVIE; echo "There are $num_movies movies in our database"; echo $movie; ?> DW shows syntax error on line 60 : which is "echo $movie:" when I remark the line, syntax doesn't go away so I know its not related to this line. When I delete the line, the error goes to the previous line. When I run in browser, I get: Parse error: syntax error, unexpected end of file in C:\wamp\www\test2\table2.php on line 60 I suspect that I missed something. Please help! Thanks
  7. The echo showed the proper contents of the variables. I actually solved this. To set the style of what the user chose, I used: <style type="text/css"> p {color:<?php echo $color; ?>; font:<?php echo $font; ?>; font-size:<?php echo $fontsize; ?>%} </style> I went back and changed the 1,2,3,4 for font size to 50, 100, 150, 200 I then used htmlspecialchars to output with css styling: Here is your text: <p><?php echo htmlspecialchars($usertxt); ?></p> And it all worked! I am a newbie, so getting the stuff to do what I want is challenging, but at least there are functions to accomplish it.
  8. $usertxt=$_POST['usertxt']; $font=$_POST['font']; $size=$_POST['size']; $color=$_POST['color']; These are my variables brought over from a page that is below: <form method="post" action="displaytext.php"> <p>What text would you like changed?<input type="text" name="usertxt" /> </p> <p>Enter your font <select name="font"> <option value="Verdana">Verdana</option> <option value="Times New Roman">Times New Roman</option> <option value="Arial">Arial</option> <option value="Comic Sans">Comic Sans</option> </select> <p>Select your font size<select name="size"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <p>Select the color you would like<select name="color"> <option value="red">Red</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="yellow">Yellow</option> </select> <P><input type="submit" name="Submit" value="Submit" /> The variables have the correct data in them, I checked. How can I show the inputted text in the size, font and color the user chose? I tried echo command but don't know how to structure. Thanks.
×
×
  • 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.