Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Not as far as I'm aware. Regards Huggie
  2. Oh, you need to do that the other way around... [code]<?php $array_name = array(1,2,3); $myvarstring = implode(",", $array_name); ?> <input type="hidden" name="test_array" value="<?=$myvarstring;?>">[/code] Regards Huggie
  3. Do you mean you want to pass a group of values in a form as a hidden field?  If so then I'd suggest something like this in your form [code]<input type="hidden" name="myformarray" value="This,Is,An,Array,Of,Words">[/code] Then make your php look like this: [code] <?php $myarray = explode(",", $_POST['myformarray']); echo "<pre>\n"; var_dump($myarray); echo "</pre>\n"; ?> [/code] Regards Huggie
  4. Never having done a project like this before I'm not in a position to offer any sound advice, just outline a few questions you should be asking yourself. Having said that, if you find some php scripts that deal with user registration and on-line training, then configuring it to use something like PayPal's IPN shouldn't actually be too difficult.  If you're unaware of Merchant Accounts, then this probably isn't the way for you to go right now, PayPal sounds like a viable solution. Regards Huggie
  5. How will you want users to pay for the service?  Are they going to be using paypal, or a merchant bank account of some kind?  You'll need to consider this when looking for a solution. Regards Huggie
  6. OK, I think a simple question has been overlooked here.  In your first post, you pasted the following form code: [code]<form action="<?php print $_SERVER['PHP_SELF'] ?>" id="Form1" style="WIDTH: 100%" method="post" > <table id="Table1" cellspacing="0" cols="2" cellpadding="0" align="center" border="0"> <tbody> <tr><td>User name:&nbsp;&nbsp;</td><td><input type='text' size='21' name="username" ></td> </tr> <tr> <td>Password:</td><td><input type="password" size="21" name="password"></td> </tr> <tr> <td></td> <td align="right"><br><input type="submit" value="Login"></td> </tr> </tbody> </table> </form>[/code] Then directly under it you posted code for members.php.  Is the above code not part of members.php? Regards Huggie
  7. You must include the variables in the URL too, so this code [code]<?php if ($page != 0) {   $back_page = $page - $limit;   echo("<a href=\"$PHP_SELF?query=$query&page=$back_page&limit=$limit\">back</a>    \n"); } for ($i=1; $i <= $pages; $i++) {   $ppage = $limit*($i - 1);   if ($ppage == $page){       echo("<b>$i</b> \n");   }   else{       echo("<a href=\"$PHP_SELF?query=$query&page=$ppage&limit=$limit\">$i</a> \n");   } } if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) {   $next_page = $page + $limit;   echo("    <a href=\"$PHP_SELF?query=$query&page=$next_page&limit=$limit\">next</a>\n"); } ?>[/code] Should look like this: [code]<?php if ($page != 0) {   $back_page = $page - $limit;   echo("<a href=\"$PHP_SELF?query=$query&page=$back_page&limit=$limit&img_title=$search_title&img_location=search_location\">back</a>    \n"); } for ($i=1; $i <= $pages; $i++) {   $ppage = $limit*($i - 1);   if ($ppage == $page){       echo("<b>$i</b> \n");   }   else{       echo("<a href=\"$PHP_SELF?query=$query&page=$ppage&limit=$limit&img_title=$search_title&img_location=search_location\">$i</a> \n");   } } if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) {   $next_page = $page + $limit;   echo("    <a href=\"$PHP_SELF?query=$query&page=$next_page&limit=$limit&img_title=$search_title&img_location=search_location\">next</a>\n"); } ?>[/code] You'll also need to capture these at the top of your script as currently you have $HTTP_POST_VARS but you'll be using $HTTP_GET_VARS for these. Regards Huggie
  8. Sounds like Absinthe or something similar. Huggie
  9. If you're putting quotes around table names they should really be backticks ( ` ) not single quotes ( ' ) and your values should be enclosed in single quotes. Regards Huggie
  10. No problem, I'm happy to help. If once you've had a go yourself you still can't get it then post back here. Regards Rich
  11. That's not the problem, the code should look like this: [code]<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("memberdir") or die(mysql_error()); $appusername = $_POST['login_name']; $apppassword = $_POST['password']; $result = mysql_query("SELECT * FROM `user` WHERE username = '$appusername' AND password = '$apppassword'"); if (mysql_num_rows($result) > 0) {   $_SESSION['authenticatedUser'] = $appusername;   header("Location: loggedon.php"); } else {   $_SESSION['message'] = "Could not connect as $appusername";   header("Location: login.php"); } ?>[/code] Regards Huggie
  12. The help I've given you on the previous project and this one should allow you to answer this question yourself now.  If you can't then I guess this is due to a failure of the 'teachings by example' on my part. In your previous project you used $HTTP_POST_VARS to get values from your form, so you should be able to use those again.  Get the values from the form and fit the code that I've provided in around it. Regards Huggie
  13. So a bulk-buying discount. Are the products going to be discounted as a % of the original cost? Regards Huggie
  14. Give this a try: [code] <?php // connect to your database include_once('connect.php'); // query the database to get all the email addresses $sql = "SELECT email FROM newsletter"; $result = mysql_query($query) or die ("Couldn't run $sql: " . mysql_error()); // set the constant parameters of the email $headers = "Content-type: text/html\n\n"; $subject = "Test Subject"; $message = "<img src=\"http://www.smeresources.org/images/newsletter-header.jpg\" alt=\"Signature\"><h1>Testing Your Newsletter</h1>"; // loop through the results sending the email while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   $toAddress = $row['email'];   // try to send the message   $success = mail($toAddress, $subject, $message, $headers);   // print message   if($success){       echo "Newsletter sent successfully to $toAddress";   }   else{       echo "Newsletter could not be sent to $toAddress";   } } ?> [/code] Regards Huggie
  15. I don't think that you've explained this well enough, and maybe you're getting confused with terminology. My advice would be to leave all technical details out and post a description of what you're trying to achieve, something like this: [color=blue][i]I have a web page with a form on it, the form fields are dynamically generated from the database, the form allows users to rate documents in the database.  I want the ratings applied in the form to be replicated through to the database.  Here's the code I have so far...[/i][/color] Something like that. Regards Huggie
  16. I suggest posting this as a new question in the forum.  Tagging new questions onto existing posts like this reduces the amount of viewers considerably. I'll take a look at it in the new post. Regards Rich
  17. Here you go: [b][size=8pt]signup.php[/size][/b] [code]<?php include('header1.tpl'); if (isset($HTTP_POST_VARS['email']) && !empty($HTTP_POST_VARS['email'])){   $email = $HTTP_POST_VARS['email'];   $email = trim($email);   $email = addslashes($email);   // open connection to MySQL server   $connection = mysql_pconnect('localhost', '', '') or die ('Unable to connect!');   // select database for use   mysql_select_db('sme_sme2') or die ('Unable to select database!');   // run query to see if email is subscribing or un-subscribing   $query = "SELECT id FROM newsletter WHERE email = '$email'";   $result = mysql_query($query) or die ("Unable to run query $query: " . mysql_error());   $exists = mysql_num_rows($result);   if ($exists == 0){       // user doesn't exist       $insert = "INSERT INTO newsletter (email) VALUES ('$email')";       $result = mysql_query($insert) or die ("Unable to insert $insert: " . mysql_error());             echo '<br/>';       echo '<center>';       echo "Thank you for signing up for smeresources newsletter, $email has been added to our list";       echo '</center>';   }   else if ($exists == 1){       // user exists       $delete = "DELETE FROM newsletter WHERE email = '$email'";       $result = mysql_query($delete) or die ("Unable to delete $delete: " . mysql_error());             echo '<br/>';       echo '<center>';       echo "$email has been un-subscribed from the smeresources newsletter";       echo '</center>';   } } else {   header("Location: form.htm"); } ?> </div> <?php include('footer.tpl'); ?>[/code] [b][size=8pt]form.htm[/size][/b] [code]<form method="post" action="signup.php" style="display:inline;"> Enter Email:<br /> <input type="text" size="20"  name="email" style="font-size: 10px;"  /><br /> <input type="image" name="submit" align="absmiddle" src="images/buttons_r1_c1.gif" alt="Submit" /></a> </form>[/code]
  18. Like a digital attendance sheet? Regards Huggie
  19. [quote author=j3rmain3 link=topic=113212.msg459909#msg459909 date=1162209212] when i type in $row['filename'] nothing appears, that is why i am using $row[1] in my coding. [/quote] That's because mysql_fetch_row() only returns a numerical array, not an associative array.  If you wanted to use $row['filename'] then you'd need to use mysql_fetch_array() or mysql_fetch_assoc(): [code] <?php while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   ... } ?> [/code] Regards Huggie
  20. I'm assuming from the code that the column 'pic' in the 'members' table contains either a 1 or a 0 depending on if they have a picture on their profile and the 'piclink' column in the 'profile' table, just contains the location of the image, e.g. http://mydomain.com/image.jpg Is this correct? Also, does every member have a row in the 'profile' table? Regards Huggie
  21. The following code has done away with your form, and just uses one file, signup.php, you should be able to call it signup.php and drop it onto your server as it is.  I'd advise backing up your existing code first in case you don't like this. It uses the above concept of adding you if you don't exist, and removing you if you do exist. Regards Huggie [code] <?php include('header1.tpl'); if (isset($HTTP_POST_VARS['email']) && !empty($HTTP_POST_VARS['email'])){   $email = $HTTP_POST_VARS['email'];   $email = trim($email);   $email = addslashes($email);   // open connection to MySQL server   $connection = mysql_pconnect('localhost', '', '') or die ('Unable to connect!');   // select database for use   mysql_select_db('sme_sme2') or die ('Unable to select database!');   // run query to see if email is subscribing or un-subscribing   $query = "SELECT id FROM newsletter WHERE email = '$email'";   $result = mysql_query($query) or die ("Unable to run query $query: " . mysql_error());   $exists = mysql_num_rows($result);   if ($exists == 0){       // user doesn't exist       $insert = "INSERT INTO newsletter (email) VALUES ('$email')";       $result = mysql_query($insert) or die ("Unable to insert $insert: " . mysql_error());             echo '<br/>';       echo '<center>';       echo "Thank you for signing up for smeresources newsletter, $email has been added to our list";       echo '</center>';   }   else if ($exists == 1){       // user exists       $delete = "DELETE FROM newsletter WHERE email = '$email'";       $result = mysql_query($delete) or die ("Unable to delete $delete: " . mysql_error());             echo '<br/>';       echo '<center>';       echo "$email has been un-subscribed from the smeresources newsletter";       echo '</center>';   } } echo <<<HTML <form method="post" action="{$_SERVER['PHP_SELF']}" style="display:inline;"> Enter Email:<br /> <input type="text" size="20"  name="email" style="font-size: 10px;"  /><br /> <input type="image" name="submit" align="absmiddle" src="images/buttons_r1_c1.gif" alt="Submit" /></a> </form> HTML; ?> </div> <?php include('footer.tpl'); ?> [/code]
  22. OK, the problem you have here is that you're not actually submitting the form.  The moment you click on the link, it's navigating to signup.php as opposed to posting to it.  What you really needed was an image field in your form. If you'd typed [code=php:0]echo $HTTP_POST_VARS['email'];[/code] at the top of signup.php, you'd have found that it didn't actually echo anything. I'd change the code slightly if I were you.  Rather than have a button for subscribe and one for un-subscribe, just have one submit button.  So I enter my email address and hit submit, if I'm subscribed already then it un-subscribes me, if I'm not then it subscribes me.  How does that sound? Regards Huggie
  23. What you're looking for is [url=http://en.wikipedia.org/wiki/Captcha]captcha[/url]. If you search these forums for that 'word' you'll come up with some solutions. Regards Huggie
  24. Can you possibly provide me the complete code that you're using for the order page now. I can work with that. Regards Huggie
  25. ok, table created, now can you post the code you're using, all php and (if separate) your form. Regards Huggie
×
×
  • 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.