-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
Hiya Mike
[quote]So...invalid HTML is okay if everything is invalid? :/[/quote]
I would say so. It doesn't matter how high the quality his code is, I purposely think he would want the code to work before going to fix it to an XHTML standard. -
But for all we know, he might not even be using a doctype.
-
I was pointing out that if you were to echo out YOUR $str line and it contained a variable ($) inside of it, that it would echo off the variable name instead of the content of the variable.
[code=php:0]
<?php
$varname = hello;
$str = '<td><p class="classname">$varname</p></td>';
echo $str;
?>
[/code]
In the table cell it would echo off $varname instead of hello, unless you went my way
[code=php:0]
<?php
$varname = hello;
$str = "<td><p class='".classname."'>$varname</p></td>";
echo $str
?>
[/code]
In which case you would get the return of hello instead of $varname. -
[code]
if(mysql_num_rows($q) == 0){
echo "no info in the table";
}else {
echo "there is information in the table
}
[/code] -
[quote author=jesirose link=topic=119797.msg490943#msg490943 date=1166930969]
[quote]$str = '<td><p style="className">Text</p></td>';[/quote]
[/quote]
Well, it wouldn't matter either way. But it would matter if he were to echo a variable. You could always escape the double quotes.
[code]
$str = "<td><p style='".classname."'>$var1 is a person</p></td>";
[/code] -
it's referring to the second line of that.
[code]
if(mysql_num_rows($q) > 1) {
echo "<tr><td align=center bgcolor=gray><font face=Arial color=#FFFFFF>-</font></td>";
echo "<td align=center bgcolor=gray><font face=Arial color=#FFFFFF">INACTIVE</font></td></tr>";
}
[/code] -
Woah, Jesi, never thought I'd see you here.
-
If you start something you have to end it.
On your query line ($q) it shows you have a never ended `. And I would go about just writing it in, instead of using $table_name -
You have a sql syntax error.
Just do something like
[code]
$q = mysql_query("SELECT * FROM `tablename`") or die (mysql_error());
[/code] -
As far as indentation something like:
[code]
if($var1 = $var){
echo "hello";
}else {
echo "wrong";
}
if....{
...
}
...
}
if...{
...
}
...
}
if...{
...
}
...
}
if...{
...
}
...
}
[/code] -
Wow, your code is a complete mess.
[code]echo "<td bgcolor="#00FFFF">WATCHING</td>";[/code]
You're basically trying to start a new string on that line.
[code]echo "<td bgcolor='".#00FFFF."'>WATCHING</td>";[/code]
Escape your quotes. You can't have another set of double quotes inside another unless you escape them.
So basically it's:
[code]singlequote(')doublequote(")period(.)TEXTINSIDEHEREperiod(.)doublequote(")singlequote(')[/code]
As long as TEXTINSIDEHERE doesn't include any single or double quotes or any periods it will work fine. You need to clean up your code too, put some indents in there so you can recognize individual if and elseif statements. -
[code=php:0]
<?php
$name = $_POST[name];
$email = $_POST[email];
$comments = $_POST[comments];
if (!isset($name) || !isset($email) || !isset($comments)) {
header("Location: http://www.mysite.com/noresponse.htm");
exit;
}else {
$msg = "E-MAIL SENT FROM $email\n";
$msg .= "Sender's Name: $name\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Sender's Place: $place\n";
$msg .= "Message: $comments\n\n";
$to = "myname@gmail.com";
$subject = " Feedback";
$mailheaders = "From: Response Forms <> \n";
$mailheaders .= "Reply-To: $email\n\n";
$send = mail($to, $subject, $msg, $mailheaders);
?>
<HTML>
<HEAD><TITLE>My site - Thank You</TITLE>
<meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm">
</HEAD>
<BODY>
<p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p>
<H1>Thank you. Your response is valuable to us.</H1>
<P><strong>Your Name:</strong>
<? echo "$name"; ?>
<P><strong>Your E-Mail Address:</strong>
<? echo "$email"; ?>
<P><strong>You are from:</strong>
<? echo "$place"; ?>
<P><strong>Message:</strong>
<? echo "$comments"; ?>
<H3>Please wait and you will be taken back to the page you were viewing</H3>
</BODY>
</HTML>
<?php
}
?>
[/code] -
Well, automatically it's trying to find the values, but they are undefined.
-
Try defining $name, $email and $comments at the top
[code]
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
?>
[/code] -
[code]
<?php
if (!isset($name) || !isset($email) || !isset($comments)) {
header("Location: http://www.mysite.com/noresponse.htm");
exit;
}else {
$msg = "E-MAIL SENT FROM $email\n";
$msg .= "Sender's Name: $name\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Sender's Place: $place\n";
$msg .= "Message: $comments\n\n";
$to = "myname@gmail.com";
$subject = " Feedback";
$mailheaders = "From: Response Forms <> \n";
$mailheaders .= "Reply-To: $email\n\n";
$send = mail($to, $subject, $msg, $mailheaders);
if($send){
?>
<HTML>
<HEAD><TITLE>My site - Thank You</TITLE>
<meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm">
</HEAD>
<BODY>
<p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p>
<H1>Thank you. Your response is valuable to us.</H1>
<P><strong>Your Name:</strong>
<? echo "$name"; ?>
<P><strong>Your E-Mail Address:</strong>
<? echo "$email"; ?>
<P><strong>You are from:</strong>
<? echo "$place"; ?>
<P><strong>Message:</strong>
<? echo "$comments"; ?>
<H3>Please wait and you will be taken back to the page you were viewing</H3>
</BODY>
</HTML>
<?php
}else {
echo "your mail was not delivered";
}
}
?>
[/code] -
Are you trying to say that you want to select the fields from the database and create a dropdown list out of them?
-
Try echoing $_SESSION and see what you get
-
href='http://cs-blog.net/file.php?url=http://chyea.net'/forums.php"
I get that -
Um, that wouldnt work, the url is given as a get, and i'm trying to make it produce it so that links with href=" will be produced in href="http://cs-blog.net/file.php?url=$url" and if it was from chyea.net the index would just stay at chyea.net then if you clicked contact it would be href="http://cs-blog.net/file.php?url=http://chyea.net versus href="http://cs-blog.net/file.php?url=http://chyea.net/contact.php"
But on the page it comes out with: http://cs-blog.net/file.php?url= but in the source it shows http://cs-blog.net/file.php?url=$url"contact.php"
[code]
<?php
$url = $_GET['url'];
if(!isset($url)){
echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form>";
}else {
$file = file_get_contents("$url");
echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form><br><br>";
$replace = 'href="http://cs-blog.net/file.php?url=$url"';
$file = str_replace('href="',$replace,$file);
$file = str_replace('../',"",$file);
echo $file;
}
?>
[/code] -
Chris, that would just output $url, literally.
-
say, the url you typed in was like miniclip.com or something. the links there are just href="/games/gamename.php"
i want so when the person clicks that it will go to ?url=http://miniclip.com/games/gamename.php
that didnt work ken, when i went to my other site, chyea.net and tried to click contact it stayed on chyea.net not chyea.net/contact.php -
Oh, so basically it replaces the text that has href= in it, to change it to href="http://cs-blog.net/file.php?url=$url""
but if i add the double quote around $url then it tries to end it -
that doesnt work either
-
Parse error: syntax error, unexpected T_STRING in /home/csblog/public_html/file.php on line 8
What I am trying to do, is to get file contents of a website and echo them off, but if a link exists i want it to also direct it to the same page
[code]
<?php
$url = $_GET['url'];
if(!isset($url)){
echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form>";
}else {
$file = file_get_contents("$url");
echo "<form method=get><input type=text name=url value=http://><input type=submit value=Go></form><br><br>";
$replace = "href='."http://cs-blog.net/file.php?url=$url".'";
$file = str_replace('href="',$replace,$file);
echo $file;
}
?>
[/code]
PHP View Info from Database
in PHP Coding Help
Posted
echo "<tr><td align=center bgcolor=gray><font face=Arial color=#FFFFFF>-</font></td>";
echo "<td align=center bgcolor=gray><font face=Arial color=#FFFFFF>INACTIVE</font></td></tr>";
}
}
elseif (mysql_num_rows($q) > 0)
[/code]
I'm not sure if you needed that bracket at the end of your echoing. Just remove the either one of the closing brackets.