Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Could you provide a sample of what the data looks like in your MySQL tables (fields, identify, content)? Also, could you provide a sample of what you want the HTML table to look like?
  2. Well you could store the header in a variable and echo it out later. ... <?php $tableHeader = '' //$tableHeader .= '<th style="width:128px">Options</th>'; $tableHeader .= ' <th> Identifier </th> '; $fieldresult = mysql_query("SELECT * FROM fields ORDER BY `order`"); while($fieldrow = mysql_fetch_array($fieldresult)) { $tableHeader .= ' <th> ' . $fieldrow["name"] . ' </th> '; } //DISPLAY TABLE HEADER echo $tableHeader . '</tr>'; ... ?> If that doesn't work, it might be helpful if you show us what you're doing with the rest of the loop.
  3. Should work if you change it to: <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?>
  4. Unless I'm missing something you should be able to close the row after the while loop: ... <?php //echo '<th style="width:128px">Options</th>'; echo ' <th> Identifier </th> '; $fieldresult = mysql_query("SELECT * FROM fields ORDER BY `order`"); while($fieldrow = mysql_fetch_array($fieldresult)) { echo ' <th> ' . $fieldrow["name"] . ' </th> '; } ?> </tr> ...
  5. Sorry to ruin the fun, but there was a quote missing here: ... VALUES ('$title', $index_image', '$content'... Note that there isn't a quote before $index_image.
  6. You just need to add the parenthsis around the last two conditions: <?php if($tf1=="RED" or $tf1=="" or ($tf2=="" and $tf=="apple")) { ?>
  7. No problem; glad to help!
  8. For what it's worth, the customer was able to enter the rest of her data using her home computer. So I'm going to assume this was a personal computer issue. Thanks to everyone who provided input!
  9. After doing a quick Google search, this tutorial looks like it might help: http://www.htmlgoodies.com/beyond/webmaster/projects/article.php/3487836/A-Simple-Order-Form-Page.htm You can probably skip all the JavaScript stuff mentioned in the tutorial which will cut out a few steps.
  10. So then the user types in the price? If so, then you should be able to create a PHP script as described by jcbones.
  11. Nevermind, I just reviewed the PHP manual for usort and it looks more complicated that I originally thought. I should have looked there first; sorry about that. But it still might be helpful to post the code you tried.
  12. What does the comparison function look like in your class? And how did you attempt to call that function? With the function inside a class, I would imagine you would need to call it like any other class method. From within the class you would call it like $this->usortFunction(). Hopefully someone will correct me if I'm wrong.
  13. I would imagine the customer will want to see the order calculation before completing their order. This would likely require a multi-stage PHP script, which would be my preferred method. But since barrycorrigan's client doesn't want a multi-stage solution, there might not be any other option except a JavaScript/AJAX solution. Of course, if the OP uses JavaScript/AJAX they'll probably want to also build a fallback solution if JavaScript is disabled or isn't available. That is if the OP has the resources required to build/maintain two solutions.
  14. Are there a lot of products in your database? If not you could load everything into the page and use JavaScript for the calculator part. Otherwise you'll probably need to look into AJAX.
  15. You could look into building a multi-stage form. The first step could ask for the reference code from the catalog and the quantity. They would submit the form to a PHP script that looks for the reference code in your database, calculates the sub total, and determines if the discount applies. After the user verifies that they entered the reference code correctly and they are happy with the price. You can then ask them for the other details (name, address, etc.). That form would be submitted to another PHP script to process everything and send out an e-mail.
  16. This can be done without AJAX...as long as you're ok with the page refreshing between steps.
  17. Could you provide a little more info. For example what are you using to edit the file? (Dreamweaver, Notepad, online solution like WordPress, etc.) It sounds like you can edit the PHP code, so it's probably not a problem with a read-only file. What happens when you try to edit the HTML? Do characters appear when you type them?
  18. For the create new option, I'm assuming that you want a blank form. But for the edit form, you'll want to get the data based on the ID and use it to populate the form. Hopefully this will be enough to get you started: <?php if(isset($_GET['page']) && $_GET['page'] == 'create') { //INITIALIZE VARIABLES $name = ''; ... } elseif(isset($_GET['page']) && $_GET['page'] == 'modify') { //GET ID if(isset($_GET['id'])) { $id = trim($_GET['id']); } ... //GET INFORMATION BASED ON THE ID ... //SQL query goes here //INITIALIZE VARIABLES BASED ON THE ID $name = $row['name']; ... } //DISPLAY THE FORM ?> ... <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> ... <th scope="row">Name</th> <td><input type="text" name="name" value="<?php echo $name;?>" /></td> ... FYI, you'll want to be careful with $_SERVER['PHP_SELF'] due to XSS vulnerabilities.
  19. If your links look like: <a href = "newForm.php?page=modify&id=<?php echo $_GET['id']; ?>">Edit</a> <a href = "newForm.php?page=create">Create New</a> Note that I removed the "id=-1" since it not necessary. You can then build your PHP script around: if(isset($_GET['page']) && $_GET['page'] == 'create') { ... } elseif(isset($_GET['page']) && $_GET['page'] == 'modify') { //GET ID if(isset($_GET['id'])) { $id = trim($_GET['id']); } ... }
  20. Nope The script uses both $_GET and $_POST. To get to the edit form, the user clicks a link with an ID variable ($_GET). Then when they submit the form the ID is sent back to the page using $_POST. The customer said she would try filling out the form on her home computer this weekend. If the form still doesn't work I may try the solution. I would need to have the customer let me know if the variable gets displayed. This would be so much easier if I could duplicate the issue, but the form works fine for me in multiple browsers and multiple computers.
  21. Quick update: I asked the customer to look at the source code and it turns out that the hidden form field is being populated. So somehow that data is being lost after the submit button is clicked.
  22. The form mentioned above is to edit training session information. It's used to pull the record for editing by this form only.
  23. I know how you feel; it can be frustrating!
  24. You need to replace the period with a comma: ... echo str_replace(",","</li>\n<li>" . $line['committed']); ... The one before $line
  25. Sorry, forgot to mention that you'll need to use double quotes for the newline characters: echo '<ul>List: <li>'; echo str_replace(',', "</li>\n<li>", $line['committed']); echo "\n</li>\n</ul>\n";
×
×
  • 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.