Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Why is PHP_EOL used in the filename? This will add a new line characters to the filename, which does not seem right. With the above code this will be generated filename (variables substituted with yyy, xxx and zzz) /site.com/public/www/prod/data/yyy_xxx_zzz _pic.png Make sure you're using the correct filepath ($path) in requinix code. Are you sure the path is correct?
  2. Umm.. You call that function with those values... // constants required by the function define('FINANCIAL_MAX_ITERATIONS', 128); define('FINANCIAL_PRECISION', 1.0e-08); $nper=120; $pmt=1009.06; $pv=100000; // pass the above values as arguments echo RATE($nper, $pmt, $pv); // output the returned rate Dont forget to define the constants
  3. Your edit link is this echo "<a href=\"edit_record_form.php?idi={$program}\">Edit> </a>"; The program is being passed to edit_record_form.php via the idi query string parameter. However in edit_record_form.php you are using $_GET['program'] this should be $_GET['idi'] The next issue (which I think maybe caused by copy and pasting the code) is the use of magic quotes “ ” or ‘ ’ in your code. Using these types of quotes to define strings/array keys will cause errors. You need to use normal straight quotes " " or ' '
  4. Where is the submit button for that from? You have only defined one input field but you appear to have no way of actually submitting the form.
  5. ok... this is wrong PHP variables cannot be read by javascript. What you need to do is add two hidden input fields to your form, which hold the values of those variables, eg echo "<tr><td><b>$row[HEAD_MARK]/$row[ID]</b> <input type=\"hidden\" name=\"HEAD_MARK\" value=\"$row[HEAD_MARK]\" /> <input type=\"hidden\" name=\"ID\" value=\"$row[ID]\" /> </td>"; Then in your javascript you $.serialize the form fields and pass that as the data $.post('process_data.php', $(form identifier).serialize(), function(response){ this.setAttribute("disabled", true), alert(response); }); }
  6. requinix code already does this, specifically this part if (!$li->hasAttribute("id") || !fnmatch("*123*", $li->getAttribute("id"))) { $li->setAttribute("id", "123"); } Have you tried replacing the 123 in the lines above with your variable?
  7. It would be helpful if you explained what you are trying to. Also the link you posted is dead.
  8. Yes always wrap the value for the value attribute in quotes, example for the firstname echo "<td><input type=text name=r_firstname size=35 value=\"$arrayvictim[victimFName]\"></td></tr>"; The \ before the " means it is escaped.
  9. What version of PHP? Post the specific version. When you run it on your version of PHP do you get any errors? If you do post them here in full.
  10. I did not tell you to remove the header/imagejpeg only the echo.
  11. Doing that will corrupt the image. I only got you to comment out those lines so you can check for errors. Does uncomentting the header/imagejpeg lines and removing the echo before those display the image now?
  12. $_POST['victimFName'] and $_POST['victimId'] should relate to the fields in your form. You do not have fields named as victimFName or victimId. You should be using $_POST['r_firstname'] and $_POST['id'] instead. $id=$_GET['victimId']; You should be sanitizing this $_GET['victimId'] before using it in your query. Either use mysql_real_escape_string or use intval to protect against SQL injection.
  13. The characters is the binary of the image. I was aware this was going to happen. If you look closely before the weird characters is there any error messages (to make it clearer you can also comment out imagejpeg() too)?
  14. What/Where is your form? Are you sure you have set the forms submit method to post and not get (which is the default)
  15. Comment out this line (add // infront of it) header('Content-Type: image/jpeg'); Run your code again. Are you getting any errors? Note when using header() no output (echo's, whitespace, text etc) can be sent before using it.
  16. That script uses this code to make a link to the users profile echo "<div class='userlist_body'><a href='profile.php?id=$userid'><b>$row[1]</b></a></div>"; Clicking the users link should then direct the user profile.php?id=<the users id> What happens when you click the link? Do you get blank page/error.
  17. jazzman1 means have you checked that the $_POST['victimFName] and $_POST['victimId] variables contains the values you expect when the form has been submitted. You can verify this by dumping the contents of $_POST by using printf('<pre>%s</pre>', print_r($_POST, true)); Just because mysql_query did not return false does not mean the query actually did anything. You should be using mysql_affected_rows to check to see if an update query actually did anything. Also take note of the big red message box on that manual page. You should upgrade your code to either MySQLi (note the i ) or PDO function libraries.
  18. Thats fine. Just remove echo's. When you come to a PHP variable you'll need to wrap it in php tags and echo it. <?php if ($session->logged_in): ?> <h1>Logged In</h1> Welcome <b><?php echo $session->username; ?></b>, you are logged in. <br><br> [<a href="userinfo.php?user=<?php echo $session->username; ?>">My Account</a>] [<a href="useredit.php">Edit Account</a>] <?php if($session->isAdmin()): ?> [<a href="admin/index.php">Admin Center</a>] <?php endif; ?> [<a href="process.php">Logout</a>] <?php else: ?> /* content for guests */ <?php endif; ?> Helps if you post the error(s) in full here What relevance does this have?
  19. Why? You already have a form. You just need to sort the issues I pointed out. The next step will be learning how to process the form with PHP. Have a read on how PHP deals with forms in the docs. File uploads are a little more complex and PHP has a section in the documentation which explains the process
  20. It look like the query is doing the hardwork for you (look at the IF in the query). So all you need to do in PHP is compare $row['checked'], when it is 1 you'd apply the checked attribute for the checkbox. If its any other value do not apply the attribute Eg while($row=mysqli_fetch_array($query1)){ $categorie_p_id=$row['cat_id']; // define the checked attribute? $checked = ($row['checked'] == 1) ? ' checked="checked"' : ''; ?> <tr> <td width="20" style="padding-bottom: 4px"><input name="selector[]" type="checkbox" value="<?php echo $categorie_p_id; ?>"<?php echo $checked; /* apply checked attribute*/?>></td>
  21. That is because you are using the wrong variable. The data is contained in the $_POST['box2'] array, so you need assign that to $new_var, example // form has been submitted if($_SERVER['REQUEST_METHOD'] == 'POST')) { // get the array of checkbox values $new_var = $_POST['box2']; // output the first item from the array echo $new_var[0]; // Or display all values in a comma delimited list echo '<br />' . implode(',', $new_var); }
  22. Your form has a few issues. Why is each file input field wrapped in its own set of <form> tags? <form action="" method="POST"> ... other fields <form action="index.php" enctype="multipart/form-data"> Select a file to upload: <input type="file" name="selectedfile" /> </form> ... other fields <form action="index.php" enctype="multipart/form-data"> Upload your website Logo For Advertising: <input type="file" name="selectedfile" /> </form> <input type="submit" name="send_message" value="Send"> </form> This is invalid HTML, <form> tags cannot contain multiple embedded <form> definitions. A form can contain multiple inputs Next you have three text fields named as sender_url <label for="field_name">Your Website URL:</label> <input type="text" id="field_url" name="sender_url"> <br /><br /> <label for="field_name">Your Website name:</label> <input type="text" id="field_url" name="sender_url"> <br /><br /> ... <label for="field_name">Your Website name:</label> <input type="text" id="field_url" name="sender_url"> <br /><br /> I understand the name given for website url field. But not for the other two? They appear to be duplicated? You should ensure each field in the form has a unique name, except for when multiple inputs are part of a group, such as radio buttons Speaking of radio buttons, I dont understand the values provided for the radio buttons here <b><p>Select Why You want to Contact US:</p></b> <input id="radio_1" type="radio" name="radio_group_1" value="shared"> <label for="radio_1">Add New link</label> <br /> <input id="radio_2" type="radio" name="radio_group_1" value="vps"> <label for="radio_2">Report Dead link</label> <br /> <input id="radio_3" type="radio" name="radio_group_1" value="dedicated"> <label for="radio_3">Advertising Price</label> What has shared, vps and dedicated got to do with those options? The value should relate to the field label in some way. Seems like this was left over from a copy and paste job.
  23. What does that mean? Post example code.
  24. No it displays the value for $row['id']. You most likely need to substitute $id in the printf with %1\$u which which will refer to the first value in the list of values for printf (in your case $row['id'] ). // +-------------------- references $row['id'] --------------+ // | | printf("<tr><td>%u</td><td><input type='checkbox' name='box2[ ]' value='%1\$u'></td><td>%s</td><td>%s</td></tr>\n", // formatted string $myrow["id"],$myrow["descr"],$myrow["batno"]); // list of values fastsol meant look at the actual HTML source code of your webpage to check to see if the value attribute for the checkboxes are being populated with a value. Can you tell use the output of this printf('<pre>%s</pre>', print_r($_POST, true)); If box2 does not show up in the array structure that statement produces when your form has been submitted then your checkboxes are not being included in same the <form></form tags as your other fields and this is why $_POST['box2'] is empty. In order for you to verify this you must check your HTML source code (right click view source) and check to make sure all <input> type tags are within your <form></form> tags.
  25. I doubt that. PHP code must always be enclosed in PHP tags, although the closing tag can be left off.
×
×
  • 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.