Jump to content

nofx1728

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by nofx1728

  1. Thanks for your help everyone. You make a good point mangy I'm going to do some additional research on that and in the short term use the @ symbol.
  2. Hi, sorry to come back once again with another question on this issue but I just discovered a new problem. Is there anyway to create a statement that will display the above information if it gathers it correctly, but not display anything at all if I get an error retrieving the information? Right now I get a large code error on my screen that is throwing my layout off. [attachment deleted by admin]
  3. Awesome. Thank you so much. This is so much cleaner then what I had come up with to get it to work. Thanks again for all your help.
  4. I modified the code a little and used an if statement instead of a for statement - coming up with this code. <?PHP $content = file_get_contents('http://www.kitco.com/texten/texten.html'); $content = explode("\n",$content); if($i=39) { $thisLine = explode(' ',preg_replace('/(?:\s\s+|\n|\t)/', ' ',$content[$i]),4); $prices[$thisLine[1]] = '$'.$thisLine[2]; } if($i=40) { $thisLine = explode(' ',preg_replace('/(?:\s\s+|\n|\t)/', ' ',$content[$i]),4); $prices1[$thisLine[1]] = '$'.$thisLine[2]; } if($i=41) { $thisLine = explode(' ',preg_replace('/(?:\s\s+|\n|\t)/', ' ',$content[$i]),4); $prices2[$thisLine[1]] = '$'.$thisLine[2]; } if($i=42) { $thisLine = explode(' ',preg_replace('/(?:\s\s+|\n|\t)/', ' ',$content[$i]),4); $prices3[$thisLine[1]] = '$'.$thisLine[2]; } ?> Then I add it to my html that I want to display: <font><marquee border="1" width="400" height="20" bgcolor="#000000" scrolldelay="10" scrollamount="1" align="middle" style="background-color: #000000; color: #FFFFFF; font-weight: bold;"><?PHP print_r($prices);?> <?PHP print_r($prices1);?> <?PHP print_r($prices2);?> <?PHP print_r($prices3);?> </font> Now the only thing I need to do is figure out a way to remove the Array ( [] ). Is there anyway to just display Gold - $xxxxx - instead of Array ([Gold] => xxxx) ?? Any help would that would be unreal. I've been googling for last 4 hours but can't seem to figure it out.
  5. That is awesome. Is there anywhere I can go to read more about what is taking place in that line of code? How exactly are you selecting only those numbers with all that information on the page? Is there anyway to change how it is outputted? I'm trying to create a finished product like this: <font><marquee border="1" width="400" height="20" bgcolor="#000000" scrolldelay="10" scrollamount="1" align="middle" style="background-color: #000000; color: #FFFFFF; font-weight: bold;>Gold: $1,824. Silver: $41.60 Platinum: $1,843.00 Palladium: $782.00 </marquee></font> I thought maybe removing the \n would accomplish the line break but I tested that and it didn't work. Either way thank you so much for your help. Just getting to this point is great.
  6. I've used a little PHP but I am not great. Is there any way to take information from a html page written in basic text and have it dynamically displayed. The content I want is found here: http://www.kitco.com/texten/texten.html I want to take the information from the following chart - only Metal and Ask and create a ticker. New York Spot Price MARKET IS OPEN Will close in 2 hour 24 minutes ---------------------------------------------------------------------- Metals Bid Ask Change Low High ---------------------------------------------------------------------- Gold 1822.80 1823.80 -12.30 -0.67% 1810.70 1840.90 Silver 41.45 41.55 +0.10 +0.24% 41.08 42.15 Platinum 1844.00 1852.00 -7.00 -0.38% 1826.00 1861.00 Palladium 783.00 788.00 +10.00 +1.29% 775.00 794.00 ---------------------------------------------------------------------- So basically I would just take the word: Gold - $1823.80 Silver - $41.55 Platinum $1852.00 Palladium - $788.00 Can someone help me through this or point me in a direction where I can read more about accomplishing this? I've been searching google for articles but still haven't found what I'm looking for. nofx1728
  7. Hi, thanks for the reply. That definately helps me know what I'm up against. I'm actually going through the video tutorials at vtc about mysql and php and when I'm finished I'm sure I'll have some additional questions. I'm not looking to complete the project for a few months. Thanks, nofx1728
  8. I'm just trying to see how difficult it would be to create a few of these scenarios. There are a few things that I would like to have on a site but I'm still learning as I go with php and databases. 1st a. Database that collects user information from a form. b. The ability to send emails to users that input their information c. Create reports from purchases 2nd a. Create accounts (about 10) for distributers - and be able to print reports on commissions (15%) of sales that are a result of their account Basically I'm trying to build a site that has a shopping cart, that can do thse things. How much code and how difficult would it be to set something up like this? Also, does anyone know of any good shopping carts - or would you recommend building my own? Thanks, nofx1728
  9. Still stuck on this problem. I tried adding - <input type="text" name="amountText" onchange="this.form.amount.value = this.value;" /> - but that did not work either. Any clue on how to redirect to paypal with the information the user inserts into the "amount" on the form?
  10. Ok I almost have this worked out. I just need to pass one variable in my form from php to javascript... anyone know how to do that. I have basic form which you can see above. I need to record the data the user inputs in the Amount, and transfer it to a page that contains javascript which redirects to paypal. Below is the javascript page that redirects. My php file is redirecting me to this page after it sends me an email. - header("Location: http://www.site.com/paypal.html"); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script language="JavaScript" type="text/javascript"> <!-- function submitForm() { document.myForm.submit(); } //--> </script> </head> <body onLoad="javascript:submitForm()"> You are being redirected to PayPal. <form name="myForm" method="post" action="https://www.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="site@email.com"> <input type="hidden" name="item_name" value="Contribution"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="return" value="http://www.site.com/thanks.php"> <input type="hidden" name="cancel_return" value="http://www.site.com/contribute/"> <input type="hidden" name="cn" value="Employer/Occupation (required)"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="bn" value="PP-DonationsBF"> </form> </body> </html> Thanks, nofx1728
  11. Ok this is what I'm trying to do.. hopefully this clarifies. I have a donations page on my website that has a form. All I want to do is collect the information on this form and email it to myself - and then redirect to paypals donations page. When I talked to the people with paypal they said I need to pass my hidden variables to the redirect page in my php script. No clue how to do that. <form method="post" name="donationform" id="donationform" action="test1.php"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="contribute@votefetterman.com"> <input type="hidden" name="item_name" value="Contribution to Adam Fetterman, Candidate for State Representative District 81"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="return" value="http://www.votefetterman.com/thanks.php"> <input type="hidden" name="cancel_return" value="http://www.votefetterman.com/contribute/"> <input type="hidden" name="cn" value="Employer/Occupation (required)"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="bn" value="PP-DonationsBF"> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="149">Contribution Amount:</td> <td width="451"><input name="amount" type="text" id="amount" size="10"> (Limit: $500 per person or organization) </td> </tr> <tr> <td>First Name:</td> <td><input name="firstname" type="text" id="firstname" size="40" value="" ></td> </tr> <tr> <td>Last Name :</td><td><input name="lastname" type="text" id="lastname" size="40" value="" ></td></tr> <tr> <td>Address 1 :</td><td><input name="address1" type="text" id="address1" size="40" value="" ></td></tr> <tr> <td>Address 2 :</td><td><input name="address2" type="text" id="address2" size="40"></td></tr> <tr> <td>City:</td><td><input name="city" type="text" size="40" id="city" value="" ></td></tr> <tr> <td>State:</td><td><input name="state" type="text" size="40" id="state" value="FL" ></td></tr> <tr> <td>Zip:</td><td><input name="zip" type="text" size="40" id="zip" value="" ></td></tr> <tr> <td>Employer:</td><td><input name="company" type="text" id="company" size="40" value="" ></td></tr> <tr> <td>Occupation:</td><td><input name="occupation" type="text" id="occupation" size="40" value="" ></td></tr> <tr> <td>Email:</td><td><input name="email" type="text" id="email" size="40" value="" > <label></label></td></tr> <tr> <td>Phone:</td><td><input name="phone1" type="text" id="phone1" size="13" maxlength="13" value=""> <select name="phonetype"> <option value="">Phone Type?</option> <option value="Home">Home</option> <option value="Work">Work</option> <option value="Mobile">Mobile</option> </select> </td></tr> </table> <label> <input type="submit" name="Submit" value="Submit"> </label> </form> <?php // Receiving variables $item_name = addslashes($_POST['item_name']); $quantity = addslashes($_POST['quantity']); $amount = addslashes($_POST['amount']); $firstname = addslashes($_POST['firstname']); $lastname = addslashes($_POST['lastname']); $address1 = addslashes($_POST['address1']); $address2 = addslashes($_POST['address2']); $city = addslashes($_POST['city']); $state = addslashes($_POST['state']); $zip = addslashes($_POST['zip']); $company = addslashes($_POST['company']); $occupation = addslashes($_POST['occupation']); $email = addslashes($_POST['email']); $phone1 = addslashes($_POST['phone1']); $phone2 = addslashes($_POST['phone2']); $phone3 = addslashes($_POST['phone3']); $phonetype = addslashes($_POST['phonetype']); // Validation if ( $amount < 0) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if ( $amount > 500) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($amount) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($firstname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($lastname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($address1) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($city) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) >30) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($zip) <5) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) >10) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($occupation) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($email) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($phone1) <10) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) >13) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } //Sending Email to form owner $pfw_header = "From: $email\r\n"; $pfw_subject = "Donation Form"; $pfw_email_to = "youremail@email.com"; $pfw_message = "item_name: $item_name\r\n" . "quantity: $quantity\r\n" . "amount: $amount\r\n" . "firstname: $firstname\r\n" . "lastname: $lastname\r\n" . "address1: $address1\r\n" . "address2: $address2\r\n" . "city: $city\r\n" . "state: $state\r\n" . "zip: $zip\r\n" . "company: $company\r\n" . "occupation: $occupation\r\n" . "email: $email\r\n" . "phone1: $phone1\r\n" . "phone2: $phone2\r\n" . "phone3: $phone3\r\n" . "phonetype: $phonetype\r\n"; mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ); <? header("Location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&busines=business@email.com&item_name=Contribution&return=returnsite.com&amount=""\n\n"); ?> That is what I have set up currently, but it does not work. Please help.
  12. no clue what that is.. very new to php.
  13. Ok, I'm completely lost and I'm very new to php scripting. I have a form on my page that has a number of hidden fields. Then in my php file I have header("Location: https://www.paypal.com/cgi-bin/webscr"); I need to be able to pass that hidden information onto the page I'm redirecting to but I have no clue how to do this. Someone please help. Thanks, nofx1728
  14. Thank you very much that clears things up. I've never worked with linux hosting, is it difficult? Sorry for going off topic here I'm just struggling to get this to work .
  15. Ok... this is probably the dumbest question anyone has ever written... but I just got off the phone with godaddy and they said I need to switch my hosting from windows to linux in order for the script to work. 1. I thought php could be used by almost any hosting (am I wrong?) 2. If I have to use linux hosting for my php script to work then why would the redirect in my php script be working? thanks, nofx1728
  16. I can not figure this out and I'm starting to get really frustrated. I tried going through your sample code and that didn't work either. If a field isn't filled out properly the error message comes up as intended, and after I submit the form it redirects me to the correct website as intended. However, the email of the form information is never being sent back to me. Can someone please help me. Here is my code: <?php // Receiving variables $item_name = addslashes($_POST['item_name']); $quantity = addslashes($_POST['quantity']); $amount = addslashes($_POST['amount']); $firstname = addslashes($_POST['firstname']); $lastname = addslashes($_POST['lastname']); $address1 = addslashes($_POST['address1']); $address2 = addslashes($_POST['address2']); $city = addslashes($_POST['city']); $state = addslashes($_POST['state']); $zip = addslashes($_POST['zip']); $company = addslashes($_POST['company']); $occupation = addslashes($_POST['occupation']); $email = addslashes($_POST['email']); $phone1 = addslashes($_POST['phone1']); $phone2 = addslashes($_POST['phone2']); $phone3 = addslashes($_POST['phone3']); $phonetype = addslashes($_POST['phonetype']); // Validation if ( $amount < 0) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if ( $amount > 500) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($amount) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid amount</font></p>"); } if (strlen($firstname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($firstname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid firstname</font></p>"); } if (strlen($lastname) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($lastname) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid lastname</font></p>"); } if (strlen($address1) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($address1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid address1</font></p>"); } if (strlen($city) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) >30) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($city) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid city</font></p>"); } if (strlen($zip) <5) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) >10) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($zip) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid zip</font></p>"); } if (strlen($occupation) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) >20) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($occupation) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid occupation</font></p>"); } if (strlen($email) <1) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) >100) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($email) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); } if (strlen($phone1) <3) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) >3) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } if (strlen($phone1) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid phone1</font></p>"); } //Sending Email to form owner $pfw_header = "From: $email\r\n"; $pfw_subject = "form test"; $pfw_email_to = "nofx1727@yahoo.com"; $pfw_message = "item_name: $item_name\r\n" . "quantity: $quantity\r\n" . "amount: $amount\r\n" . "firstname: $firstname\r\n" . "lastname: $lastname\r\n" . "address1: $address1\r\n" . "address2: $address2\r\n" . "city: $city\r\n" . "state: $state\r\n" . "zip: $zip\r\n" . "company: $company\r\n" . "occupation: $occupation\r\n" . "email: $email\r\n" . "phone1: $phone1\r\n" . "phone2: $phone2\r\n" . "phone3: $phone3\r\n" . "phonetype: $phonetype\r\n"; mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ); header("Location: https://www.paypal.com/cgi-bin/webscr"); ?>
×
×
  • 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.