Jump to content

frshjb373

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by frshjb373

  1. I very much appreciate the help, but sorry, I may not be following you...If I don't echo it, the image won't show up in the dropdown.
  2. I tried putting an anchor tag on the image and then anchored it as the value in the text box, but that shows the code for both the image and the anchor html code. Any suggestions?
  3. I am using the search query below to populate my jquery auto complete. The image shows up great in the search, but when I select an item from my search, it populates the text box with the href code as well. For example: <img src="images/catalog-images/1211767440.png" width="100" >Apple iPhone 4S - 32GB Just trying to figure out how to remove the image link after item is selected. Any help is much appreciated. Thank you in advance! <?php $q=$_GET['q']; $my_data = str_replace(array("'", '"'), array("", ""), $q); //$my_data=mysql_real_escape_string($q); $mysqli=mysqli_connect($DB_host,$DB_user,$DB_pass,$DB_name) or die("Database Error"); $sql="SELECT * FROM cell_brands WHERE name LIKE '%$my_data%' OR keyword1 LIKE '%$my_data%' OR keyword2 LIKE '%$my_data%'"; $result = mysqli_query($mysqli,$sql) or die(mysqli_error()); if($result) { while($row=mysqli_fetch_array($result)) { echo "<img src=\"images/catalog-images/" . $row["photo-image"] . "\" width=\"100\" >"; echo $row['name']."\n"; } } //mysql_close($mysqli); ?>
  4. I'm trying to add 2 to the $price each time the variables below isset (contrarily, I don't want to add 2 to the $price for any variable that is empty) . I have pasted my current sample code below. It works with the first statement by itself, but when I add more than one if statement it causes an error. Please advise what the best way to handle this is? I'm sure it's very simple...but I'm missing something. Still a beginner. Thank you in advance for the help! <?php $price = 135; ?> <?php if (isset($field_Charger)) { $price = $price + 2; } if (isset($field_Case)) { $price = $price + 2; } if (isset($field_Software)) { $price = $price + 2; } if (isset($field_Manual)) { $price = $price + 2; } if (isset($field_Box)) { $price = $price + 2; ?> <?php echo $price; ?>
  5. I do not sell products, but rather purchase used electronics from users through my website. There are several forms on different pages and currently each submission comes through separately through each form. I'd really like to set up the forms so that if a customer has more than one item they are looking to sell, they can fill out more than one form and submit all forms at once. Basically, I'd like to build a cart system using my existing forms. A. Is this possible without using a database? B. Any resources would be much appreciated. I'm still a beginner in PHP so I do realize this is going to be a challenge. I look forward to hearing back. Thank you in advance for the help!
  6. Unfortunately that did not work. Should I be referring to my pages in the code without the .php or use a slash in front of the page? Also, the rule you provided broke my redirect code: RewriteEngine on <Files .htaccess> order allow,deny deny from all </Files> ErrorDocument 404 /404.php RewriteCond %{HTTP_HOST} ^joytothewild\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.joytothewild\.com$ RewriteRule ^(.*)$ "http\:\/\/www\.joytothewildphotos\.com\/$1" [R=301,L] Any other ideas? Also, thank you for the help.
  7. I want to remove .php extension from all my urls. I've tried a ton of htaccess codes that I found on the web, but nothing seems to work. Isn't there a way to refer to a page within your site simply by naming the file name without the extension? For example, I currently have: <a href="birds.php">Birds</a> But how do I make something like the following work? <a href="birds">Birds</a> or <a href="/birds">Birds</a> Any help would be much appreciated. Thanks in advance!
  8. Duh! I'm a bonehead. Thanks for the help!
  9. Can't seem to get this code right. Actually, I'm not even sure if you can place PHP tags within another PHP tag. If anyone has any advice, it would be much appreciated! <?php if (isset($image)) { echo "<img src=\"images/gallery-photos/<?php echo $image; ?>\" border=0>"; } elseif (!isset($image)) { } echo "<img src=\"images/contact-01.png\" border=0>"; ?>
  10. I'm not sure I'm in the right place, but I'm looking to create a unique URL that links to the same page every time I send an email after a form is submitted on my website and have it expire after 15 days. After expiring, the link would redirect to a default page. I'm still a beginner and realize this is probably going to be a tough task, but any resources or direction provided would be much appreciated. Thanks for the help in advance!
  11. I'm trying to write a script to validate a legal php variable name, but I can't seem to make it work so it doesn't validate spaces. Any help would be much appreciated! Here's my code: <fieldset><legend><h1>PHP Variable Validator</h1></legend> <p>A valid PHP variable begins with the dollar sign ("$") followed by either a letter or underscore ("_") followed by any series of numbers, letters or underscores.</p> <p>Ex: $variable</p> <form action="name_validator.php" method="post"> <input name="variable" type="text" /> <input name="submit" type="submit" value="Validate it!" /> </form> <?php $variable = $_POST['variable']; if ($variable == "quit") { echo "Thanks for trying the validator!"; } elseif (preg_match("/^[$][a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/",$variable)) { echo "<b>" . $variable . "</b>" . " is a valid PHP variable name"; } elseif (!isset($variable)) { echo ""; } else { echo "<b>" . $variable . "</b>" . " is not a valid PHP variable name"; } ?> </fieldset>
  12. Thank you for the reply. I am a bit of beginner...what would the code look like then, to avoid this error?
  13. I have been working on my local machine and haven't had any errors. I just deployed my site live and I'm getting a database error in my auto-complete text box. Any help would be much appreciated! I'm thinking there may be an error in my the way I'm naming the mysql connect names, but the fact that database data is being populated is confusing me. Wondering if something is wrong with the code? Thanks for the help in advance! These are the errors: Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/content/99/7862599/html/gadgetabulous/Database/filename.php on line 3 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/99/7862599/html/gadgetabulous/Database/filename.php on line 3 (here is a link if you want to see the error: http://gadgetabulous.com/cellphoneform.php(just type "iphone" in the search box and the error will appear)) Here is my db file: <?php $q=$_GET['q']; $my_data=mysql_real_escape_string($q); $mysqli=mysqli_connect('host','root','password','dbname') or die("Database Error"); $sql="SELECT name FROM cell_brands WHERE name LIKE '%$my_data%' ORDER BY name"; $result = mysqli_query($mysqli,$sql) or die(mysqli_error()); if($result) { while($row=mysqli_fetch_array($result)) { echo $row['name']."\n"; } } mysql_close($mysqli); ?> Thank you in advance for the help!
  14. I am trying to add a comma between each variable selected on a multiple checkbox form. I was able to successfully add a comma between each variable, but if a checkbox isn't selected it still uses a comma in the array. I'm sure it's just a simple if/else statement, but I'm a newbie and I'm not quite sure how to solve. Please see a sample below. Any help is much appreciated. Thank you in advance! <?php $accessories_ary = array($field_Charger, $field_Case, $field_Software, $field_Manual, $field_Box); $accessories = implode(", ", $accessories_ary); substr_replace($accessories ,"",-1); echo $accessories ?>
  15. I am trying to build a form that will process all the user inputted information, and put those contents into an html table so that I can send the info to both my customer and myself. I figured out how to send an email to myself as html, but the user email is arriving as plain text with all the html tags. Someone had suggested PHPMailer, but I cannot figure out how to format it properly to work with my setup. I am new to PHP so this is a learning curve. I have included a sample of my process form with fictitious email addresses. Any help is much appreciated. Thank you in advance for the help! <?php header("Location: ../contactthank.php"); ?> <?PHP $field_Type = $_POST['field_Type']; $field_Service_Provider = $_POST['field_Service_Provider']; $field_Brand = $_POST['field_Brand']; $field_Model = htmlspecialchars($_POST['field_Model']); $field_Size = $_POST['field_Size']; $field_Charger = $_POST['field_Charger']; $field_Case = $_POST['field_Case']; $field_Software = $_POST['field_Software']; $field_Manual = $_POST['field_Manual']; $field_Box = $_POST['field_Box']; $field_Condition = $_POST['field_Condition']; $field_FirstName = htmlspecialchars($_POST['field_FirstName']); $field_LastName = htmlspecialchars($_POST['field_LastName']); $field_Email = $_POST['field_Email']; $field_ZipCode = (int)$_POST['field_ZipCode']; $field_Comments = $_POST['field_Comments']; ?> <?php $reference = (rand(100000000000,99999999999999)); echo $reference; ?> <?php $to = "email@mail.com"; $subject = "Submission# $reference"; $headers = 'From: $field_Email' . "\r\n"; $message = '<html> <head> <title>Cell Phone Form Submission</title> </head> <body> <h1>Thank you for your submission. We will get back to you shortly</h1> <table border="1"> <tr> <td>Reference#</td> <td>' . $reference . '</td> </tr> <tr> <td>I want to</td> <td><b>Sell</b></td> </tr> <tr> <td>Service Provider</td> <td>' . $field_Service_Provider . '</td> </tr> <tr> <td>Model</td> <td>' . $field_Model . '</td> </tr> <tr> <td>Size</td> <td> ' . $field_Size . '</td> </tr> <tr> <td>Accessories</td> <td>' . $field_Charger . " " . $field_Case . " " . $field_Software . " " . $field_Manual . " " . $field_Box . '</td> </tr> <tr> <td>Condition</td> <td>' . $field_Condition . '</td> </tr> <tr> <td>Name</td> <td>' . $field_FirstName . " " . $field_LastName . '</td> </tr> <tr> <td>Email</td> <td>' . $field_Email . '</td> </tr> <tr> <td>Zip Code</td> <td>' . $field_ZipCode . '</td> </tr> <tr> <td>Comments</td> <td>' . $field_Comments . '</td> </tr> </table></body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $user = "$field_Email"; $usersubject = "Form Submission# $reference"; $userheaders = "From: email@mail.com\n"; $usermessage = '<html> <head> <title>Form Submission</title> </head> <body> <h1>Thank you. We will get back to you shortly</h1> <table border="1"> <tr> <td>Reference#</td> <td>' . $reference . '</td> </tr> <tr> <td>I want to</td> <td><b>Sell</b></td> </tr> <tr> <td>Service Provider</td> <td>' . $field_Service_Provider . '</td> </tr> <tr> <td>Model</td> <td>' . $field_Model . '</td> </tr> <tr> <td>Size</td> <td> ' . $field_Size . '</td> </tr> <tr> <td>Accessories</td> <td>' . $field_Charger . " " . $field_Case . " " . $field_Software . " " . $field_Manual . " " . $field_Box . '</td> </tr> <tr> <td>Condition</td> <td>' . $field_Condition . '</td> </tr> <tr> <td>Name</td> <td>' . $field_FirstName . " " . $field_LastName . '</td> </tr> <tr> <td>Email</td> <td>' . $field_Email . '</td> </tr> <tr> <td>Zip Code</td> <td>' . $field_ZipCode . '</td> </tr> <tr> <td>Comments</td> <td>' . $field_Comments . '</td> </tr> </table></body> </html> '; mail($to,$subject,$message,$headers); mail($user,$usersubject,$usermessage,$userheaders,$headers); ?>
×
×
  • 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.