Jump to content

ericthomson

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ericthomson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to use the php mail function and want to include links to a dynamic page, so I need to know how to do this... Something like: $id=$_POST['id']; $mailto="email@address.com"; $mailsub="Subject"; $mailhead="From: other@address.com"; $mailbody="Your comment has been posted. You may view it by <a href='domain.com/page.php?id=".$id."'>clicking here</a>."; mail($mailto, $mailsub, $mailbody, $mailhead); I know this is not correct but I'm trying to figure out the actual way to do this...
  2. No, but I was under the impression that dynamic pages cannot be crawled? Is that true?
  3. I am trying to create a very basic "forum"/comments section and I want to know how to have a page be automatically created once the form is submitted. I have found the code: <?php function wwwcopy($link,$file) { $fp = @fopen($link,"r"); while(!feof($fp)) { $cont.= fread($fp,1024); } fclose($fp); $fp2 = @fopen($file,"w"); fwrite($fp2,$cont); fclose($fp2); } //Example on using this function //wwwcopy("http://www.domain.com/list.php?member=sample", "sample.html"); //Another example //wwwcopy("http://www.domain.com/list.php?member=sample2", "sample2.html"); ?> I am using post for my forum (not even sure how get would handle the comments section). How can I use this (or tweak it)? The variables I am passing are $User, $Email, $Title, $Comments, $Date. Would I still use it the same? ie: wwwcopy("http://www.domain.com/forum/new-post.php?User=$User&Email=$Email&Title=$Title&Comments=$Comments&Date=$Date", "X.php");? Also, the value for X is up in the air. I've considered using the auto increment id(index) number from the mySQL database this is saved in.
  4. Finally! Thank you all. Sorry ManiacDan for my frustrated tantrum. Appreciate the help.
  5. Echoing my imploderesult I get a value of 4 (or 2,4 etc). So do I need to use something other than IN? Like Index[$imploderesult] or Index=$imploderesult? How do I check the mysql errors?
  6. Ok, good eye. It should be Closed, but that didn't fix it either. I don't get how implode works exactly, but should there be another parameter with the WHERE command? Where Index is what? Or does implode handle that? It returns [X] => checked so is that saying "Where Index [X] is checked"?
  7. Like this: if (isset($_POST['close'])){ $idList = array_keys($_POST['close']); $idList = array_map('intval', $idList); $implValue = implode(',', $idList); $closequery = "UPDATE sellerinfo SET Close='y' WHERE Index IN ($implValue)"; mysql_query($closequery); } I am assuming i did it wrong because it's not working.
  8. print_r($_POST['close']) gives me: Array ( [2] => checked [4] => checked ), or whatever numbers I click, so I'm guessing that is working right and the if isset should run... echo $closequery gives me: UPDATE sellerinfo SET Close='y' WHERE Index IN ('.implode(',', Array).') is idList supposed to be returning "Array"?
  9. Listen, we get it. On the internet you actually have some sort of power and we're all relatively happy for you. But sarcasm doesn't have to be the default. If you don't want to be helpful or constructive there are others that can help me. I'm not a programmer and I'm asking for help with my code, not for vague references to programming principles. I have Google for that, I don't need a forum. I've wrapped those 3 lines inside of if(isset($_POST['close'])) and added mysql_query($closequery) inside the if statement. Print_r gives me "Array ( [4] => checked ) 1" (which is the one I had checked).
  10. Ok. That makes sense. I guess the mysql_real_escape_string is one of those intentional mistakes ManiacDan warns about in his disclaimer. It is still not working right so I am guessing there is something in how I am setting up the form and/or table that is wrong. Here is the full code. Thanks for your non-sarcastic help. <?PHP include 'sellersconfig.php'; include 'opendb.php'; $idList = array_keys($_POST['close']); $idList = array_map('intval', $idList); $closequery = "UPDATE sellerinfo SET Close='y' WHERE Index IN ('.implode(',', $idList).')"; $i = 0; $o = 0; $getinfo="SELECT * FROM sellerinfo WHERE Closed='n'"; $result=mysql_query($getinfo); echo "<form method='post' action='/seller-list-test.php'>\n"; echo "<table>\n"; while ($row=mysql_fetch_array($result)) { $itemindex = $row['Index']; echo "<tr>\n"; if ($i > 0) { echo "<td width='25%' valign='middle' style='border-top:thin #000 solid; padding-top:10px;'>"; } else { echo "<td width='25%' valign='middle'>"; } $i++; echo "<input type='checkbox' name='close[$itemindex]' value='checked' /> Clear Entry?"; echo "</td>"; if ($o > 0) { echo "<td width='75%' valign='top' style='border-top:thin #000 solid; padding-bottom:10px; padding-top:10px;'>"; } else { echo "<td width='75%' valign='top' style='padding-bottom:10px;'>"; } $o++; echo "<i>".$row['Date']."</i><br />"; echo $row['LastName'].", ". $row['FirstName']." - ".$row['PhoneNumber']." - <a href='mailto:".$row['EmailAddress']."'>".$row['EmailAddress']."</a><br />".$row['StreetNumber']." ".$row['StreetName'].", ".$row['City'].", TX ".$row['ZipCode']."<br />"; echo "<strong>Lender: </strong> "; if ($row['Lender'] != "" || $row['Lender'] != NULL) { echo $row['Lender']; } else { echo "Unspecified"; } echo "<br />"; echo "<strong>Monthly Payment:</strong> "; if ($row['Payment'] != "" || $row['Payment'] != NULL) { echo $row['Payment']; } else { echo "Unspecified"; } echo "<br />"; echo "<strong>Payment Status:</strong> "; if ($row['PayStatus'] != "" || $row['PayStatus'] != NULL) { echo $row['PayStatus']; } else { echo "Unspecified"; } echo "<br />"; echo "<strong>Second Mortgage:</strong> "; if ($row['Second'] != "" || $row['Second'] != NULL) { echo $row['Second']; } else { echo "Unspecified"; } echo "<br /><br />"; echo "</td>\n</tr>"; } echo "<tr>\n<td>\n<input name='clearitems' type='submit' value='Clear Items' />\n</td>\n</tr>\n"; echo "</table>"; echo "</form>"; include 'closedb.php'; ?>
  11. Line 109 (was) closequery. Now I put that within the if(isset and the error is gone, but checking the box and clicking submit does nothing. Anything else look wrong? Or do you need the rest of the code?
  12. Ok, here is the code I have now, thanks to you: //db connect... $closequery = "UPDATE sellerinfo SET Closed = 'y' WHERE Index IN (".mysql_real_escape_string(implode(',',$_POST['close'])).")"; $i = 0; $getinfo="SELECT * FROM sellerinfo WHERE Closed='n'"; $result=mysql_query($getinfo); echo "<form method='post' action='/seller-list-test.php'>\n"; echo "<table>\n"; while ($row=mysql_fetch_array($result)) { $itemindex = $row['Index']; echo "<tr>\n"; if ($i > 0) { echo "<td width='25%' valign='middle' style='border-top:thin #000 solid;'>"; } else { echo "<td width='25%' valign='middle'>"; } $i++; echo "<input type='checkbox' name='close[$itemindex]' value='checked' /> Clear Entry?"; //... The error I'm getting is:
  13. Thanks a lot, I'll try that. So would I use "close[$row]" for my example? Or would I set a new variable to the index column value of that current $row selection?
  14. I currently have a page where I have each row in my table listed using: $getinfo="SELECT * FROM tablename WHERE Closed='n'"; $result=mysql_query($getinfo); while ($row=mysql_fetch_array($result)){ ... // list of user information } That successfully displays my content. What I am trying to do is have a checkbox next to each user (row) that when I check them and hit submit at the bottom, it will change the value of each row on the 'Closed' column to 'y' so it will not be displayed when the page is refreshed. I want to be able to select multiple items to "close". And I would like it to come back to this page. I think I can use this page as the form action and have the code above my while loop to change the Closed column so it then would not be displayed when the while loop is called... is that right? How do I set this up? Not sure where to start the form tag and where to end it, and not sure how to...well...do any of it.
×
×
  • 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.