Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. One way would be to put a field in the database that provides a 'yes' or 'no' for the downloads and have your query reflect only the yes's.
  2. One thing for certain is your form field validation isn't working as I was able to submit the form twice when it was completely blank. That's probably because you're using the variables which haven't been declared or set. if(empty($advisorsName) || empty($advisorDepartment) || empty($nominatedBy) || empty($reason) || empty($status)) Try it this way: if(empty($_POST['advisorsName']) || empty($_POST['advisorDepartment']) || empty($_POST['nominatedBy']) || empty($_POST['reason']) || empty($_POST['status'])) This way it will check against the actual posting of the field values. The variables have to be set in order for the emails to contain anything. Like this: $advisorsName = $_POST['advisorsname']; $advisorDepartment = $_POST['advisordepartment']; etc. for each field in your form. Then they will also be populated in your email.
  3. genericnumber1, thanks for pointing that out. The comment was to invoke a sense of the proper way to write code so it's clear and concise. Personally i've never seen any of the guru's in here leave the action field empty.
  4. That's some goofy code. There's no 'action' defined in your form. The php code should be either ahead of your HTML or in a separate file even, depending upon how you want the form to work. It can either submit to itself or submit to another page that parses the input. You also need to declare your 'texto' variable like this: $texto = $_POST['texto']; just above your mysql info.
  5. Yes, I assumed you wanted the title to be a hyperlink so I set it up that way. If you want to display the id and title in separate cells and also make the id the hyperlink then you'd do this. Also note that there's a <TH> tag in there that will name your fields for you. <?php echo "<table><tr>"; echo "<th>ID</th><th>Title</th></tr>"; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><td><a href='modules.php?name=4ndvddb&rop=show_dvd&id=" . $row['id'] . "'>ID</a><td> " . $row['title'] . "</td></tr> "; } echo "</table><br>\n"; ?>
  6. Create the PHP script that includes whatever HTML you want it to display and in one of the table cells in you Myspace page use an 'include' tag <include file="yourphpscript.php"> You will probably need to use the entire URL to the script file. Just a quick note. To execute PHP scripts your page has to have a PHP extension.
  7. Just a question, why wouldn't you just use an 'id' field in there that is auto-incremented?
  8. You might try doing it this way: <?php while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><td>"; echo "<a href='modules.php?name=4ndvddb&rop=show_dvd&id=" . $row['id'] . "'> Title: " . $row['title'] . "</a> "; echo "</td></tr>"; } ?>
  9. you'd use the 'WHERE' clause in your query: $sql = "SELECT * FROM table_name WHERE room_id='$room_id' "; You would set the value for $room_id by passing the id through the URL and snatching it with the $_GET statement url: http://www.yoursite.com/getstuff.php?room_id=12 then, in your script: $room_id = $_GET['room_id'];
  10. Xinil, thanks for that example. I can understand it as it applies to incrementing the number of cells needed per column. I see you have, in your example, $totalColumns set to 5. I'd probably change that to 3 and I don't see anywhere else in your example where that would affect anything. Ted, i'm looking at whatever works best. If I made the columns a fixed number then i'd like to see the code snippet that would display it that way. Could you please? Thanks to both of you
  11. I'm creating a classifieds system and need to list the categories in say a 3 column layout. I know how to 'while' loop through an array to display rows. In this case, however, I need to display the categories in a table where each cell is a separate item instead of the row constituting a record/row from the database. Should look like: Category 1 Category 2 Category 3 Category 4Category 5Category 6 Category 7Category 8Category 9 etc. There would also be some sub-cats displayed in each cell as well. What i'm looking for is the coding that would create a table row when needed and how it would place the results starting left-to-right for as many cells/rows as needed.
  12. ?? SSL support for MySQL? I've only heard of SSL support for domains. Not for a database server. This is a new one for me.
  13. You could have the XML set for the last 100 if you want. Just have to make sure you have room for them on your page. The other key is, you can use that same snippet in dozens of locations throughout your site (like category pages) and just have it call a different XML file relative to the topic you've placed it in.
  14. It depends on the feed. Imagine this. The 'feeder' site publishes an XML file that you pull into your site using the snippet of code. The XML file contains instructions to parse the last 25 tutorials added to their database which is added to daily by various authors, let's say. So, no matter what, each day as long as there are new tutorials published they will be fed to your site and displayed. New content. Simple.
  15. Ok, then perhaps instead of creating an array with the checkboxes you may consider having each one as a separate form field. Example: <input type="checkbox" name="banned1" value="1"> <input type="checkbox" name="banned2" value="1"> <input type="checkbox" name="banned3" value="1"> This way you can set a separate variable for each field and whichever one is selected would be inserted into the database.
  16. Simple. To provide an easy way to import continually updated content into your site (or, export to sites). To 'syndicate'.
  17. this snippet of code will read and parse the RSS feed XML file: <?php // The @ is to supress the function´ errors $newsfeed = 'http://url/to/file.xml'; $fp = @fopen($newsfeed, 'r'); while(!feof($fp)){ $row .= @fgets($fp, 4096); } @fclose($fp); if( eregi('<item>(.*)</item>', $row, $rowitem ) ) { $item = explode('<item>', $rowitem[0]); for( $i = 0; $i < count($item) - 1; $i ) { eregi('<title>(.*)</title>', $item[$i 1], $title ); eregi('<url>(.*)</url>', $item[$i 1], $url ); eregi('<categorie>(.*)</categorie>', $item[$i 1], $categorie); echo '<a href="' . $url[1] . '">' . $title[1] . '</a> - ' . $categorie[1] . '<br />'; } } ?>
  18. What do you want your data to look like in the database? In other words, say they select all the checkboxes. Do you want the database field to contain all the choices? Or, do you perhaps want each choice to occupy its own field?
  19. Seems to work on mine. I created the text file, ran the code and it increments by 1 digit each time I refresh the page.
  20. You have to create an array regarding the answers/boxes checked. Like this: <input name="inquiry_a[]" type="checkbox" value="answer_1"></input> Answer 1 <br /> <input name="inquiry_a[]" type="checkbox" value="answer_2"></input> Answer 2 <br /> With the brackets. That establishes the array called 'inquiry_a' for which you can then manipulate each response.
  21. Your problem lies here: while ($row = mysql_fetch_array (result, MYSQL_ASSOC)) { should be: while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { Gotta make sure you reference the right 'result'.
  22. That's what I explained in the second post. The <input type="file"> creates an array containing a few info items about the file that are important in the upload process. Your code is missing an ingredient for printing the info. Should be like this: print_r($_FILES['upload_file']; // or whatever you named the field or, $file_loc = $_FILES['upload_file']; echo $file_loc;
  23. Ok, getting clearer So, you want a popup window with a search/browse button so they can locate a file. But, you don't want the file uploaded. Just the location of it? So you can insert that location into a database? Not sure how that's going to work since the location may be on their hard drive. In a <form> you create the 'Browse' button and field by designating the type as a "file": <input type="file" name="uploaded_file" > On submit that automatically tells the form to upload the file selected which then starts a chain reaction of info about the file being placed into an array so you can further manipulate it. This includes the name of the file that can be stored in the database. Now, one possibility may be in how your form is set up. This tag is required if you're looking to upload a file: enctype="multipart/form-data" Honestly I don't know what the form would do if the tag is missing. It might ignore the upload and just create a browse button that would fill a text field that you could use to provide a value to a variable in $_POST mode so you can place it into the database. Don't know, haven't tried, not sure, just a guess. Might just break, not work, etc. etc. But, somehow you need to create a browse button/field that doesn't upload anything on submit except the entry.
  24. Sorry, doesn't make any sense. ???
×
×
  • 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.