Jump to content

davidannis

Members
  • Posts

    627
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davidannis

  1. The link should look like this (in context in viewmsg.php <b><p><a href="inbox.php">Inbox</a> | <a href="compose.php">Compose</a> |<a href="compose.php?replyto=<?php echo $sender?>">Reply to this message</a> | <a href="sent.php">Sentbox</a></b> <b><p><?php echo "$pm_count"." of 50 Total | "."$percent"."% full"; ?></p></b> Then in compose try something like: else { if ($_GET['replyto']!='') $receiver=$_GET['replyto']; //Here's the form for the input ?>
  2. I'd just make a link back to compose.php?replyto=$sender and then use the $_GET['replyto'] to address the message. Try it and we'll help with bugs.
  3. Did you include the line <?php You shouldn't. You're already in php.
  4. This might also be worth checking out http://pear.php.net/reference/PhpDocumentor-latest/Cpdf/Cpdf.html#class_details
  5. I have used fpdf and smarty templates to do what you described. There is also http://www.tcpdf.org/ http://sourceforge.net/projects/pc4p/ and http://sourceforge.net/projects/pdf-php/
  6. Instead of calling the function each time: Door : <select name="door" > <option>----</option> <option value="white" <?php if(get_value('door') == "white") { echo 'selected="selected"'; } ?> >white </option> <option value="red" <?php if(get_value('door') == "red") { echo 'selected="selected"'; } ?> >red </option> </select> you can call it once and use the return value multiple times which will be more efficient: Door : <select name="door" > <?php $door_val=get_value('door')?> <option>----</option> <option value="white" <?php if($door_value == "white") { echo 'selected="selected"'; } ?> >white </option> <option value="red" <?php if($door_value == "red") { echo 'selected="selected"'; } ?> >red </option> </select> another strategy is to store the values of the colors in an array and then loop through it to create the select. That way, if you want to add 20 more colors you just add them once and don;t have a ton of code: Door : <select name="door" > <?php $door_val=get_value('door'); $door_colors=Array ('blue','green','red'); ?> <option>----</option> <?php foreach ($door_colors as $color){ echo '<option value="'.$color.'" '; if ($color == $door_val) echo "selected=\"selected\""; echo ">$color </option>"; }
  7. jarv, you need the parentheses around ($i+1). I edited the post but not before you saw it. or TOA's solution will work.
  8. change echo 'Book Title '.$i.': '.$BookTitle[$i].'<br />'; to echo 'Book Title '.($i+1).': '.$BookTitle[$i].'<br />';
  9. Alternatively, if you stick with this login system (which I would recommend against) this line, which you should a gives you the username. $username = $_COOKIE['ID_my_site']; and you should have it on all your pages already.
  10. I really don't like the way your login script stores the password in a cookie. That's not very secure. I guess it depends what you are trying to do but storing a password in plain text and passing it back from the browser with every page request is just sloppy. To address Requinix's concern you should create a staff_id column as she detailed in post #6 and substitute $_SESSION['staff_id'] for $_SESSION['username'] in the code I posted.
  11. At the top of the login script add a session_start(); Note: this needs to happen before you output anything, so just put it at the top of the script. Then after the user is verified do this: $_SESSION['username']=$variable_you_stored_username_in ; on the script that you use to record form data you'll do the session_start() at the top again and have something like this: $sanitized_field1=mysqli_real_escape_string($connection, $_POST[field1']; // sanitize all fields thsi way $sql="INSERT into `dispatch` ('field_name', 'some_other_name', 'username') VALUES ('$sanitized_field1', '$sanitized_field2', $_SESSION['username'])";
  12. Link not working for me.
  13. I think you want to use jQuery and Ajax. I would suggest buying a book and working through it.
  14. Try this: <?php if ($_POST['games']!='') echo '<h1>Last time you selected '.$_POST['games'].'</h1>'; ?> <form action="mypage.php" method="POST"> <p>Select a game:</p> <select name="games" size="3"> <option value="1">game1</option> <option value="2">game2</option> </select> <input type="submit"> </form> save it as mypage.php and run it a couple of times to see how it works.
  15. Can you provide a little more detail on what you are trying to do? Where do you want the values to come from?
  16. mikosiko is right. You need to post code. Without seeing any code my best guesses are that you need an actual table name where you have (table name) in your select, you don't have a valid connection to the database, or you are not retrieving and displaying the results after the mysql_query.
  17. $myvar=$_SERVER['REMOTE_ADDR'];
  18. Use the php mail function. http://php.net/manual/en/function.mail.php If you have trouble post again and we'll help.
  19. What Jessica said is do something like this: //Note: removed ! in the line below if(isset($_GET['limit'])) { $num_rows=intval($_GET['limit'] ) ; //cast to an integer - makes it work for any number of rows $fetch = mysql_query("SELECT * FROM (table name) LIMIT 0, $num_rows")or die(mysql_error()); } also needed to remove the test for if limit was 10
  20. You never connected to the database. You will need to create the database and add the table first. I'd recommend using PhpMyAdmin. Google mysql php tutorial for an overview of how MySQL works or perhaps Jessica can recommend one. Then you need a line in your code before you do anything wiht Mysql like $con = mysqli_connect("localhost", "my_user", "my_password", 'my_db');
  21. I think that you should not try to create the table in your script. mysqli_query($con,"CREATE TABLE $tbl_name"); Set it up once, before your site goes live and forget about it. When you create the table make the phone column a unique key. This will not allow a duplicate phone to be inserted. Before the insert try something like: $result=mysqli_query($con,"SELECT * FROM $tblname WHERE phone=$phone"); $row_cnt = mysqli_num_rows($result); if ($row_cnt>0){ echo "this phone number has already been used"; }else{ // Do your insert here }
  22. I pointed that out in replies 18 and 19 on this thread. If OP doesn't fix it this go around I think I'm done with this topic. Apologies for the snarky tone.
  23. You didn't apply the previously mentioned fixes. This: <td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td> should be something like this: <td><form action=\"bills.php\" method=\"POST\"> <input type=\"submit\" name=\"submit\" value=\"Remove\"><input type=\"hidden\" name=\"id\" value=\"$id\"></form></td>
  24. You can concatenate the two fields: $cost=$_POST['pounds'].'.'.$_POST['pence];
  25. I would save the data to a database and when they go to the first page check to see if a session exists and if it does retrieve the data and fill the form.
×
×
  • 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.