-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Send email to address based on text choice
cyberRobot replied to blepblep's topic in PHP Coding Help
Instead of forms, could you links? <tr><th>Review Forum</th><th>Review ID</th><th>Send E-mail</th></tr> <tr><td>TC CNOSS</td><td>TC19</td><td><a href="sendMomEmail.php?sendemail=TCCNOSS">Send e-mail to TC CNOSS</a></td></tr> The links could be processed with a switch(): <?php switch($_GET['sendemail']) { case 'TCCNOSS': $toEmail = 'TCCNOSS@test.com'; break; } // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); mail($toEmail, 'My Subject', $message); ?> -
Send email to address based on text choice
cyberRobot replied to blepblep's topic in PHP Coding Help
What does your form code look like? -
What are you trying to do? A code sample might be helpful. Could you just ignore form fields which haven't been filled out?
-
Help, where's the error in this? (Print)
cyberRobot replied to CrashOkami's topic in PHP Coding Help
There's normally a mark as solved button near the bottom of the page. -
Assuming the above code is checking that the password matches the re-typed password field, you'll want to display an error if they don't match. To do that, you would use not equals: <?php //... elseif ($password != $re_password) { echo "Password is not typed in correctly"; } //... ?> Also, I would recommend checking out the trim() function: http://php.net/manual/en/function.trim.php Using trim() on the form input helps prevent errors from visitors accidentally typing a space before/after the username for example. <?php $username = trim($_POST['username']); ?>
-
For more information on the return statement, the following might help: http://php.net/manual/en/function.return.php
-
Basically, you would wrap the admin option in an if statement: if(adminIsLoggedIn) { display admin options } display options for everyone outside of the if
-
Simple CSS media query not working in Firefox 12
cyberRobot replied to cyberRobot's topic in CSS Help
You may be on to something. After adding the proper DOCTYPE, title, etc. to get the HTML to validate, the code works in IE9 now. I'll have to check the real code later. -
Simple CSS media query not working in Firefox 12
cyberRobot replied to cyberRobot's topic in CSS Help
Well, apparently this may be a problem with the install of Firefox I was using last night. The code works in Firefox 11 and 12 on two other computers. However, the code doesn't seem to work in Internet Explorer 9 on either of these computers--it was working last night though. -
Anyone know why the following media query doesn't work in Firefox 12? <html> <head> <style type="text/css"> p { display:none; } @media (max-width: 460px) { p { display:block; } } </style> </head> <body><p>here</p></body> </html> Note that it works as expected in Chrome and Internet Explorer. Also, the media query example by A List Apart (http://www.alistapart.com/d/responsive-web-design/ex/ex-site-FINAL.html) works in Firefox...
-
Do either of these help? http://www.xaprb.com/blog/2005/12/06/find-missing-numbers-in-a-sequence-with-sql/ http://www.ehow.com/how_8591747_missing-numbers-php-array.html
-
It doesn't remove the closing slash though.
-
This may seem like a silly question, but are you pointing Chrome and Internet Explorer to the same location? Maybe one is looking at the "live" version while the other is pointing to a development server? The reason I ask is that the image tag is also slightly different. Chrome seems to be outputting as XHTML while Internet Explorer outputs as HTML. ...823.jpg&w=90&h=60'/> - Chrome ...823.jpg&w=90&h=60'> - IE
-
Hmm... Glad to help!
-
Assuming the code appears as described above, there's an extra "<?php". $photo7 = $photo7['photo_name']; <?php if (file_exists("../smallphotos/".$photo7.".jpg")) { ?> Should be $photo7 = $photo7['photo_name']; if (file_exists("../smallphotos/".$photo7.".jpg")) { ?>
-
Could you tell me more about the information you're working with? For example, is the content in a database which is indexed with a primary key? Or maybe you have a bunch of pages named "page1.php", "page2.php", "page3.php", etc. Note that if your data is ordered numerically like above, you could use the numeric value to determine the value for the next/previous links. Of course, you would need some way to determine the max number of pages (or images, or whatever) <?php $max_num_pages = 10; $current_page = 2; $prev_link = ''; $next_link = ''; if($current_page != 1) { $prev_link = $current_page - 1; } if($current_page != $max_num_pages) { $next_link = $current_page +1; } print "<a href='$prev_link'>Prev Page</a> | <a href='$next_link'>Next Page</a>"; ?>
-
I'm pretty sure you need to use the "case" label before each case: <?php switch($country){ case 1: case 2: case 3: case 4: $agelimit=18; break; } ?> For more information, visit http://php.net/manual/en/control-structures.switch.php
-
First I would recommend assigning country to a variable named $country: <?php $country = $_POST['country']; ?> Then figure out the age limit based on the country value. For example <?php switch($country) { case 35: $agelimit=21; break; //United States case 5: $agelimit=18; break; //Canada ... } ?> Then just modify the age limit test: <?php if($age >= $agelimit) ?> Note: the switch() part of the above code would be dependent on how the age limit data stored. If it's stored in a database, you could run a query instead of using switch().
-
$_GET['login_failed'] isn't set to anything in the header redirect. Try something like: <?php //... header('Location: login.php?login_failed=1'); //... ?>
-
You could also have multiple echo statements: <?php do { echo " <table width='150' border='0'> <tr><td align='left' valign='top'> <a href='edit-page.php?page={$page['pageid']}'"; if($page['status']==0){ echo "class='inactive'"; } echo ">{$page['pagename']}</a> </td></tr> </table>"; }while ($page = mysql_fetch_assoc($pagesq)); ?>
-
The query is currently set up to be an exact match? Since you're using LIKE, you'll probably need to add some wildcard characters... <?php //... $result = mysql_query("SELECT * FROM tc_tool.review WHERE docNumber like '%$docNumber%'"); //... ?> For more information, see: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html Also, since it sounds like $docNumber contains user input, you might need to look into mysql_real_escape_string() if you haven't already: http://php.net/manual/en/function.mysql-real-escape-string.php
-
To figure out how many pages (or clicks) that would be needed to view all the content, you would need to perform a few calculations. For example, let's say we have a database with 100 entries and 10 entries are displayed per page. Well, the website visitor would need to view 10 pages to see everything. Next we just need a way to figure out where in those 10 pages the visitor currently is. If they're on page 7, the links for the next/previous page could be created. For more specifics on how to do the above, the pagination tutorials should give you an idea on how it works.
-
I would consider this to be a form of pagination. You're basically splitting content across multiple pages which can be presented logically in a linear fashion. The tutorials for pagination should provide a workable solution. You just need to throw out the part for generating/displaying the page numbers. Just concentrate on the code that generates the Previous/Next links and figure out a way to apply it to your situation.
-
The $POST array isn't defined until the form is submitted.