Jump to content

Lawlssbatmbl

Members
  • Posts

    10
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Lawlssbatmbl

  1. Stickler for Syntax maybe , but no Microsoft fan. Unix anyday of the week. I just found this gottcha with one of the lines where I had a value with two words with a space between. Saved to the database ok , but when it redrew the table it only showed the first word. Fixed it with this tricky "\" combo. Before echo "<td><input name=\"excision_type\" type=\"text\" value=" . $excision_type . "></td>"; After echo "<td><input name=\"excision_type\" type=\"text\" value=\"" . $excision_type . "\"></td>"; Shows you the importance of those double quotes. lol
  2. Something like this . echo "<table align=\"center\" width=\"500\" border=\"0\" background=\"images/FormBG.png\">"; echo "<tr><td colspan=\"5\" height=\"50\"><font size=\"5\">Excision Type</font><td></tr>"; echo "<tr><th>ID</th><th>Type</th><th>Name</th></tr>"; while ($stmt->fetch()) { echo "<form method=\"post\" action=\"excision.php\"> "; echo "<tr><td><input name=\"excision_id\" type=\"hidden\" value=" . $excision_id . ">" . $excision_id . "</td>" ; echo "<td><input name=\"excision_type\" type=\"text\" value=" . $excision_type . "></td>"; echo "<td><input name=\"excision_name\" type=\"text\" value=" . $excision_name . "></td>"; echo "<td><input name=\"edit\" src=\"/IC/images/Clipboard 3.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Edit\"></td>"; echo "<td><input name=\"delete\" src=\"/IC/images/Close - Cancel 1.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Delete\"></td></tr>"; echo "</form>"; } echo "<form method=\"post\" action=\"excision.php\"> "; echo "<tr><td> </td>" ; echo " <td><input name=\"a_excision_type\" type=\"text\"></td>"; echo " <td><input name=\"a_excision_name\" type=\"text\"></td>"; echo " <td><input name=\"add\" src=\"/IC/images/Add Green.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Add\"></td>"; echo " <td></td></tr>"; echo "</form>" ; echo "</table>" ;
  3. Checked the $_POST('add_x') value being set fixed the issue . Thanks for the help. Consider this solved.
  4. You are right i'm just checking using ISSET($_POST('add')) can you give me an example of how I would change this.
  5. I used this you tube php development lessions to help me get the basics Lesson 39 - 40 is probably what your looking for. http://www.youtube.com/watch?v=od0UM78JXg0&list=PL6627A6DA3C3A772E
  6. Ive been working on a simple web form I wanted to replace the basic submit button with icon images , but for some reason my posts dont seem to work now. Can you offer some solutions. echo "<table align=\"center\" width=\"500\" border=\"0\" background=\"images/FormBG.png\">"; echo "<tr><td colspan=\"5\" height=\"50\"><font size=\"5\">Excision Type</font><td></tr>"; echo "<tr><th>ID</th><th>Type</th><th>Name</th></tr>"; while ($stmt->fetch()) { echo "<form method=\"post\" action=\"excision.php\"> "; echo "<tr><td><input name=\"excision_id\" type=\"hidden\" value=" . $excision_id . ">" . $excision_id . "</td>" ; echo "<td><input name=\"excision_type\" type=\"text\" value=" . $excision_type . "></td>"; echo "<td><input name=\"excision_name\" type=\"text\" value=" . $excision_name . "></td>"; echo "<td><input name=\"edit\" src=\"/IC/images/Clipboard 3.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Edit\"></td>"; echo "<td><input name=\"delete\" src=\"/IC/images/Close - Cancel 1.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Delete\"></td></tr>"; echo "</form>"; } echo "<form method=\"post\" action=\"excision.php\"> "; echo "<tr><td> </td>" ; echo " <td><input name=\"a_excision_type\" type=\"text\"></td>"; echo " <td><input name=\"a_excision_name\" type=\"text\"></td>"; echo " <td><input name=\"add\" src=\"/IC/images/Add Green.png\" type=\"image\" style=\"height:24px; width:24px \" value=\"Add\"></td>"; echo " <td></td></tr>"; echo "</form>" ; echo "</table>" ; Heres the example of the post code higher up in the same php script. if (ISSET($_POST['add'])) { $exc_type = mysqli_real_escape_string($db,$_POST['a_excision_type']); $exc_name = mysqli_real_escape_string($db,$_POST['a_excision_name']); if (strlen($exc_type) > 20) fail('Excision Type too long (MAX : 20 characters)'); if (strlen($exc_name) > 45) fail('Excision Name too long (MAX : 45 characters)'); ($astmt = $db->prepare('insert into excision_type (excision_type, excision_name) values (?,?)')) || fail('MySQL prepare', $db->error); $astmt->bind_param('ss', $exc_type, $exc_name) || fail('MySQL bind_param', $db->error); if (!$astmt->execute()) { /* Figure out why this failed - maybe the username is already taken? * It could be more reliable/portable to issue a SELECT query here. We would * definitely need to do that (or at least include code to do it) if we were * supporting multiple kinds of database backends, not just MySQL. However, * the prepared statements interface we're using is MySQL-specific anyway. */ if ($db->errno === 1062 /* ER_DUP_ENTRY */) fail('This Excision Type is already taken.'); else fail('MySQL execute', $db->error); } } I know the code works when I use the type="submit" so its not a syntax issue , I suspect that changing type from "submit" to "image" has some suttle differences.
  7. Thanks for all your help . You can consider this answered.
  8. Thanks Alot , that solved my issue. Got really confusing using double quotes as I have a td and img tags that use double quotes and wasnt sure if I had to escape them all out . echo " <td width="20"><a href="./filename.php?id=$rows['name']"><img src="filename" width="16" height="16" /> </a></td> " echo " <td width=\"20\"><a href=\"./filename.php?id={$rows['name']}\"><img src=\"filename\" width=\"16\" height=\"16\" /> </a></td> " is the second one correct if using double quotes?
  9. might want to read this first , also has some demo files you can use . www.openwall.com/articles/PHP-Users-Passwords I found it useful setting up my own login pages.
  10. $sql = "select satisfaction_id,satisfaction_type from satisfaction_type order by satisfaction_id"; $result = mysqli_query($db,$sql); while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)) { echo ("<tr><td>$row[satisfaction_type]</td>"); echo (' <td width="20"><a href="http://localhost/IC/satisfactioneditform.php?id=$row[satisfaction_id]"> <img src="images/Clipboard 3.png" width="20" height="20" title="Edit" border="0" /></a></td>'); echo (' <td width="20"><a href="http://localhost/IC/satisfactiondelete.php?id=$row[satisfaction_id]"> <img src="images/Close - Cancel 1.png" width="20" height="20" alt="" title="Delete" border="0" /></a></td></tr>'); } Need some help with the passing the value of $row[satisfaction_id] to the next php page. at present all im getting is the actual text for id as "$row[satisfaction_id" as apposed to the actual value which is a integer. The problem as I see it is the double quotes is probably stopping the variable being evaulated. so im geting just the variable name rather than the value . complex quoting issue had to use single quotes for the echo statement to get around the double quotes used in the html tag options. Thanks in advance.
×
×
  • 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.