-
Posts
1,469 -
Joined
-
Last visited
-
Days Won
12
Everything posted by CroNiX
-
How can I mix a font tag with php database variables?
CroNiX replied to AlexanderBlade's topic in PHP Coding Help
The <font> tag has been deprecated from HTML5, so you really shouldn't use it. You should be using CSS to control your visual presentation. You also have mismatched font tags (opening starts with upper-case, closing is all lower-case. echo 'Price: <span style="font-size:50px">' . $tournament["pricePerPlayer"] . '</span>'; Ultimately it would REALLY be best to use a stylesheet, and then just give the span an ID or a classname, with the style for that ID/Classname defined in the stylesheet. -
ajax post not being posted to php (for sql query)
CroNiX replied to blahaha's topic in PHP Coding Help
In your ajax request, all do you is send the request but do nothing with the result that gets returned. Look at the success(), comlete(), error(), etc, events of jQuery's ajax function. Since your ajax request is supposed to be returning HTML (based on your code), this shouldn't be set to 'text' in your ajax request. It should be left off completely or set to 'html': dataType: "text" , I believe this line is wrong: $data .= $data . '<div>' . $d['name'] . '</div>'; and should be $data .= '<div>' . $d['name'] . '</div>'; This SQL looks wrong and you should be using a LIKE instead of an = for country: if($query = mysql_query("SELECT name FROM recipes2 WHERE country='%$var%'")) -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
What did you change to fix it? Just curious... -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
Do you have your server set to show you errors? Try this at the top of your page above the <html> tag: <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); ?> Also, your files that contain any php code should use the php extension instead of html, or the server won't parse them as php. Like if the page that isn't working is "index.html" you need to rename it to "index.php" I should also ask, are you sure you have php installed and running on the server? you could easily check by creating this file in the root directory of your site: info.php which only contains: <?php phpinfo(); ?> Then go to http://yoursite.com/info.php and see if you get a big page telling you all about php installed on your server. -
Are these PDF and CSV files something that already exist on the server, or would they have to be created on the fly when someone presses one of the buttons? If they're already existing, just provide links and style them to look like a button or whatever you want: <a href="/path/to/the/file.pdf">PDF</a> If they don't exist, its a bit more complex as the link would be going to a php page or something, which generates the PDF and then sends it to the browser.
-
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
BTW: I'd combine your css files into a single file and just use comments to create sections so it's easy to find stuff: styles.css /* Header */ div#header { color:green } /* Footer */ div#footer { font-weight: bold; color: red } /* Content */ div#content { color: black; padding: 10px } -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
Yes, but you can put those in a header.php and footer.php file. Lets say "header.php" contained: <div id="header">This is my header</div> And footer.php contained: <div id="footer">This is my footer</div> Then in all of your other files you would: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="footer.css" type="text/css"/> <link rel="stylesheet" href="header.css" type="text/css"/> </head> <body> <?php include('path/to/header.php'); ?> <div id="content">Here is the content for this page</div> <?php include('path/to/footer.php'); ?> </body> </html> -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
CSS by itself won't create a header or footer. They are only styles, not HTML markup. The HTML markup for the header and footer must also appear on all pages for the stylesheets to be able to apply style them. It would be more helpful if you posted the full HTML for both of your pages to troubleshoot this instead of just little snippets. -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
You can use just "footer.css" if all of your webpages are located in the same directory as the footer.css file, because that's what you're telling it by just using the filename instead of the path to the filename..."look for footer.css in the same directory as this web page". -
Keeping my header and footer on all webpages using PHP?
CroNiX replied to Coplestone's topic in PHP Coding Help
What you're doing is exactly the same thing as your first post. I think your problem for including the css on subsequent pages is the location of the files on your webserver. <link rel="stylesheet" href="footer.css" type="text/css"/> Instead of just "footer.css", put the full url to the footer.css location, like 'http://yoursite.com/css/footer.css" (or just /css/footer.css) -
One thing I'm not sure of...is why you replace the contents of #lastviewer (the form), with the result of your ajax upon ajax completion (success event). Is the result from ajax the same form again? Because the ajax is sending the form data over and over every 3 seconds, but then you're replacing the contents of the form so it might not work on subsequent ajax calls unless the response from your ajax IS the form HTML again.
-
Sorry, meant extension not driver. Ok, so you have pdo_mysql and pdo_odbc enabled, but which one are you using to connect to the db and query?
-
Usually it doesn't just say "undefined index". It says which index is undefined and which line it is occurring on. So exactly what does the notice say? But again, my guess is that child1age isn't a field in the table you are querying, or isn't present in the result for some reason.
-
Poll/Servey Script need to add IP check so people can't resubmit vote
CroNiX replied to cobusbo's topic in PHP Coding Help
Maybe have another file like voter_ids.txt. 1) When someone submits the form, check that voter_ids.txt file to see if their $_SERVER["HTTP_X_MXIT_USERID_R"] id exists in there. If it does, they've already voted and show them a message. 2) If not, continue saving the data to your text files, and also include $_SERVER["HTTP_X_MXIT_USERID_R"] in voter_ids.txt so you know they've voted. Then if they try to submit the form again, it will get caught by #1 above since their $_SERVER["HTTP_X_MXIT_USERID_R"] ID will exist in the voter_ids.txt file. -
Dynamic form post using implode inserts duplicate entries.
CroNiX replied to ztimer's topic in PHP Coding Help
if(!isset($_SESSION['Username'])){ header("Location: login.php"); return; //or exit(), or die() } Make sure code execution stops when redirecting. -
What is undefined? Perhaps 'child1age' doesn't exist in your $row. We know 'child1name' exists because you test for it, so 'child1age' is the only other thing there that could be causing an issue. Hard do know since you chopped off the code showing the actual query, and what you selected.
-
Yes, I'd also put all of the js into a separate file. Then in your footer HTML, just do something like: <?php if ($page=="home"): ?> <script type="text/javascript" src="http://yoursite.com/js/your_footer_script.js"></script> <?php endif; ?>
-
What DB driver are you using to query your db within PHP?
-
In the loop, instead of: $doc = '##FILE##'; Try $doc[0] = '##FILE##'; And when you echo $newxml, use htmlspecialchars() so you see everything, like htmlspecialchars($newxml)
-
You're not sending the form data in your ajax: add: data: $('#lastviewer').serialize()
-
Personally I use the alternative syntax in my views: <?php if (some_condition): ?> <h2>Yay, it passed</h2> <?php else: ?> <h3>It didn't pass</h3> <?php endif; ?> Then my editor still respects the HTML syntax highlighting since it's still separate, the php highlighting, as well as not using the stupid braces, which I also abhor.
-
Having trouble sending a PDF to user's browser...
CroNiX replied to MutantJohn's topic in PHP Coding Help
Most likely due to root owning the dir which takes precedence. Try placing the file in your web root dir, or somewhere else where the apache user has permissions for.