Jump to content

jotorres1

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by jotorres1

  1. Have you tried debugging this? Print out the string that is in $frontimage, you might be surprised. Second, I would definitely take out those semicolons inside the if brackets.
  2. When sending headers in you PHP, there cannot be not one character before it, and that includes, not even space.
  3. It's in this code: <?php //Start session session_start(); if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) { header("location: prijava.php"); exit(); } require_once('config.php'); include ("include/head.php"); ?> <body> <div id="main_container"> I'm assuming you have HTML tags before this php script. header needs to be called before any output. <?php // ETC... // header goes up here before <html> tag ?> <html><head> etc...
  4. Need to make sure they are set: <?php echo"Delivery <input type='radio' name='ORDER' value='delivery' <?php if(isset($DEL)){echo $DEL;?>> \n"; echo"Take Out <input type='radio' name='ORDER' value='takeout' <?php if(isset($TAKE)){echo $TAKE;?>> \n"; echo"Eat in <input type='radio' name='ORDER' value='eatin' <?php if(isset($EAT)){echo $EAT;?>> \n"; ?>
  5. If I were you, I would use the confirm on the form submit. <form method="POST" action="yourpage.php" id="submitform" name="submitform"> <input type="Submit" name="Submit" value="Submit" onClick="return confirmSubmit()"> </form> The javascript should look like this: <script LANGUAGE="JavaScript"> <!-- function confirmSubmit() { var poqty = document.getElementById('txtpoqty'); var chkqty = document.getElementById('chkqty'); if(poqty != chkqty){ var agree=confirm("YOU ARE GOING TO CHANGE QUANTITY. ARE YOU SURE?"); if (agree) return true ; else return false ; } } return true; // --> </script>
  6. It can also be done that way, then extract all the post variables: On second page would be: $_SESSION['post_data'] = $_POST; On first page you can extract: if(isset($_SESSION['post_data'])) {extract($_SESSION['post_data'];} And then refer to all the variables directly; $PTYPE, $ORDER etc..
  7. Hello Timmy, I would recommend the use of sessions. Use session_start() on both pages. When the user submits the first page, on page 2, you should register the user inputs. For example: on page 2 should be something like this: <?php session_start(); $_SESSION['ORDER'] = $_POST['ORDER']; $_SESSION['PTYPE'] = $_POST['PTYPE']; $_SESSION['DTYPE'] = $_POST['DTYPE']; $_SESSION['PSIZE'] = $_POST['PSIZE']; $_SESSION['DSIZE'] = $_POST['DSIZE']; $_SESSION['PTYPE2'] = $_POST['PTYPE2']; $_SESSION['DTYPE2'] = $_POST['DTYPE2']; $_SESSION['PSIZE2'] = $_POST['PSIZE2']; $_SESSION['DSIZE2'] = $_POST['DSIZE2']; $_SESSION['PTYPE3'] = $_POST['PTYPE3']; $_SESSION['DTYPE3'] = $_POST['DTYPE3']; $_SESSION['PSIZE3'] = $_POST['PSIZE3']; $_SESSION['DSIZE3'] = $_POST['DSIZE3']; // And etc... for all those user inputs. ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title>Title of the document</title> <meta name="description" content="Type a Short Description Here" /> <meta name="keywords" content="type, keywords, here" /> <meta name="author" content="Your Name" /> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> ... etc.... Then on your first page, you would have something like this: <?php if(isset($_SESSION['PTYPE'])){ if ($_SESSION['PTYPE'] == 'no pizza') { $NOPIZZA='selected' ; }elseif ($_SESSION['PTYPE'] == 'cheese') { $CHEESE='selected' ; }elseif ($_SESSION['PTYPE'] =='pepporoni') { $PEPPORONI='selected' ; }elseif ($_SESSION['PTYPE']=='veggie') { $VEGGIE='selected' ; }elseif ($_SESSION['PTYPE'] =='meat lovers') { $MEAT='selected' ; } } echo"<br/>Pizza: <select name='PTYPE'>\n"; echo"<option></option>"; echo"<option $NOPIZZA>no pizza</option>"; echo"<option $CHEESE>cheese</option>"; echo"<option $PEPPORONI>pepporoni</option>"; echo"<option $VEGGIE>veggie</option>"; echo"<option $MEAT>meat lovers</option>"; echo"</select> "; That's just an overview of what can be done.
  8. Hi c_pattle, I haven't seen it done with objects, but it is possible with arrays. I would do the following: <?php $i=1; ?> <?php foreach ($query->result_array() as $row): ?> <?php echo $row['order_id']; ?> <?php $next = $query->next_row('array'); ?> // I placed array in param for it to return an array <?php $i++; ?> <?php endforeach; ?>
  9. Are you declaring $gen with the following statement: <?php $gen = $_GET['gen']; ?> Also, you need to be careful with that script. It is at high risk for mysql injection. Take a look at this tutorial from tizag to understand a bit of injection. http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php
  10. I would suggest to just autoload it in the autoload config file.
  11. You should read this post I have just published. http://www.jotorres.com/en/2011/12/remapping-function-calls-in-codeigniter/ It should help out with uri-rerouting, and have nicer looking urls.
  12. Hi c_pattle, Here is what I have promised: http://www.jotorres.com/en/2011/12/remapping-function-calls-in-codeigniter/ Hope you enjoy and understand.
  13. Hi c_pattle, This should not be in your view file. If this is in your view file, then it's referring to a local variable, not the config file variable. I would recommend using _remap. I will not explain what it is here in this post, but if you give me until tomorow, my post will publish. It will teach you to use it, and I have a very simple example in which you will be able to modify it for your needs. I regret not posting it today, as I had no time to finish it. I will come back once it's published. (The latest will be by tomorrow) If you can't wait that long, then go ahead and google _remap.
  14. Wow, I didn't catch that either, you need the quotes 'topic_id' in order to get the value from url. Nice find mjdamato
  15. Try: <?php //check for required info from the query string if (!isset($_GET[topic_id])) { header("Location: topiclist.php"); exit; }
  16. What will happen if the user has 5 images? All of those images will be named 1.jpg? 1.jpg, 1.jpg and so on... I still suggest my approach
  17. Just add parameters to your function function search($searchCat, $searchString){ etc.. }
  18. Trust me, you will avoid unnecessary headaches in the future.
  19. I would suggest using a table specifically for images. Table user_images: imageid userid image_name image_path image_thumb image_default (set it to 0 or 1, 1 = profile image, 0 = just an image for that user) Then, when you look for users with images, then you can look up this table, and join the users table with the userid. This should make it a lot simpler to handle the images of each user.
  20. Try changing this: $row = mysql_fetch_row($result); $_SESSION['registertest'] = $row; to this: $row = mysql_fetch_array($result); $_SESSION['registertest'] = $row[0];
  21. Try using the query I gave you, and use the result. That should help you with what you need, without having to do all that 'get random' number stuff. <?php $query = "SELECT * FROM `table` WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM `table` ) ORDER BY id LIMIT 1"; $result = mysql_query($query); $row = mysql_fetch_row($result); ?> Hope that helps.
  22. Are you sure id will always contain all numbers from 0 to max without skipping any numbers? What will happen if you delete a row, and insert another? You could consider this: <?php $query = "SELECT * FROM `table` WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM `table` ) ORDER BY id LIMIT 1"; ?>
  23. Hey, take a look at how I write to a file. The post is about a file upload, but it also writes to the file. You might learn something. Hope it helps. http://www.jotorres.com/en/2011/10/simple-file-upload-in-php/
  24. I'm glad you got it to work. Note though, that you did mention you wanted the value onto the next page.
×
×
  • 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.