Jump to content

xandercrews

Members
  • Posts

    6
  • Joined

  • Last visited

About xandercrews

  • Birthday 10/30/1986

Previous Fields

  • Languages
    HTML, PHP, CSS, MySQL

Profile Information

  • Location
    Dallas, Tx
  • Interests
    SEO, Marketing, Web Design, Design, Sales

xandercrews's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ah, I didn't need that echo part, basically it just deletes a line and redirects to the homepage to input or delete another line. it's working fine now, thanks for the direction.
  2. <?php$id = $_GET['id'];$lines = file('watchlist.txt');$file = "watchlist.txt"; foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";}unset($lines[$id]);implode("\n",$lines);file_put_contents($file,$lines); echo "You are trying to delete " . $id . " from " . $lines . ".";?>
  3. Am I on the right track? <?php$id = $_GET['id'];$lines = file('watchlist.txt');foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";}unset($lines[$id]);echo "You are trying to delete " . $id . " from " . $lines . ".";?>
  4. Alright, I have ran into another problem, basically what I have is a script that writes to a flat txt file, nothing fancy. Then it displays the file on the index. <?phpecho "<table>";$f = fopen("watchlist.txt", "r");$a = 1;while (($line = fgetcsv($f)) !== false) { echo "<tr>"; foreach ($line as $cell) { echo "<td>" . htmlspecialchars($cell) . "<a href='remove.php?id=" . $a++ . "'><img src='cross.png'></td>"; } echo "<tr>\n";}fclose($f);echo "</table>";?> at the end of each line is displayed an image with a link to increase by 1, which is the line that relates to the text file.I have searched and searched but cannot seem to find the code I'm looking for for removal.Basically I want to remove the line $id from my txt file. I cannot find anything that will do this.
  5. I click submit, and nothing happens. It is supposed to email me with the information stored. When I hit submit it just sits there. No loading, nothing.
  6. So basically, I have taken a form, re-arranged it and I have messed something up along the way. quote.php: <table id="form" border="0" cellpadding="0" cellspacing="5" width="100%"> <form method="post" action="http://www.mysite.com/sendquote.php"></form> <tbody><tr> <td colspan="2" align="right" bgcolor="#CCCCCC"><strong>Select Make</strong> <span>*</span></td> <td colspan="2" align="left" bgcolor="#CCCCCC"><select name="make" id="make"> <option value="">Select One</option> <option value="Acura">Acura</option>.... <option value="Yugo">Yugo</option> </select></td> </tr> <tr> <td align="left">Select Model <span>*</span></td> <td align="left"><input name="model" id="model" type="text"></td> <td align="left">Year <span>*</span></td> <td align="left"><select name="year" id="year"> <option value="">Selct One</option> <option value="2012"> 2012 </option>..... <option value="1961"> 1961 </option> </select></td> </tr> <tr> <td align="left">VIN <span>*</span></td> <td align="left"><input name="vin" id="vin" type="text"></td> <td align="left">Odometer: (Write "0" if N/A)</td> <td align="left"><input name="odometer" id="odometer" type="text"></td> </tr> <tr> <td align="left">Does it start and drive? <span>*</span></td> <td align="left"><select name="driveable" id="driveable"> <option selected="selected" value="Start and Drivable">Start and Drivable</option> <option value="Start - will not run">Start - will not run</option> <option value="Will not start">Will not start</option> </select></td> <td align="left">Do you have the title in hand ?<span>*</span></td> <td align="left"><select name="title" id="title"> <option selected="selected" value="Yes - Clear in Hand">Yes - Clear in Hand</option> <option value="Yes - Salvage Title">Yes - Salvage Title</option> <option value="No - I lost it">No - I lost it</option> <option value="No - It is not my car">No - It is not my car</option> </select></td> </tr> <tr> <td align="left">Ever been in an accident or flood <span>*</span></td> <td align="left"><select name="accidentflood" id="accidentflood"> <option selected="selected" value="NO">NO</option> <option value="Yes - Accident">Yes - Accident</option> <option value="Yes - Flood">Yes - Flood</option> </select></td> <td align="left">Price expected (Optional)</td> <td align="left"><select name="price" id="price"> <option value="">Choose Amount</option> <option value="Not Sure">Not Sure</option> <option value="$50">$50</option> <option value="More than $5000">More than $5000</option> </select></td> </tr> <tr> <td colspan="4" align="left" bgcolor="#CCCCCC"><strong>Describe condition of vehicle including missing parts, body and mechanical damages:</strong></td> </tr> <tr> <td colspan="4" align="center"><textarea name="comments" onkeypress="return maxLength(this,"501");" onblur="return maxLengthPaste(this,"501");" rows="3" cols="40"></textarea></td> </tr> <tr> <td colspan="4" align="left" bgcolor="#CCCCCC"><strong>Seller Info</strong></td> </tr> <tr> <td align="right"> Name <span>*</span></td> <td align="left"><input name="fname" id="fname" type="text"></td> <td align="right">Email <span>*</span></td> <td align="left"><input name="email" id="email" type="text"></td> </tr> <tr> <td align="right">Phone <span>*</span></td> <td align="left">(<input name="phone1" id="phone1" maxlength="3" style="width:40px;" type="text">) <input name="phno" id="phno" maxlength="8" style="width:90px;" type="text"></td> <td align="right">Zip Code <span>*</span></td> <td align="left"><input maxlength="5" name="zip" type="text"></td> </tr> <tr> <td colspan="4" align="center"><input name="submit" id="submit" value="Submit" style="width:100px;" type="submit"></td> </tr></tbody></table> sendquote.php <?php$mailto = 'myemail@gmail.com' ;$subject = "Quote Request" ;$formurl = "http://www.mysite.com/quote.php" ;$errorurl = "http://www.mysite.com/quote.php" ;$thankyouurl = "http://www.mysite.com/quote.php" ;$uself = 0;$use_sendmailfrom = 0;$use_webmaster_email_for_from = 0;$use_utf8 = 1;$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {ini_set( 'sendmail_from', $mailto );}$firstname = addslashes($_POST['fname']) ;$zip = addslashes($_POST['zip']) ;$phone = addslashes($_POST['phone1']) ;$email = addslashes($_POST['email']) ;$comments = addslashes($_POST['comments']) ;$make = addslashes($_POST['make']) ;$model = addslashes($_POST['model']) ;$year = addslashes($_POST['year']) ;$vin = addslashes($_POST['vin']) ;$odometer = addslashes($_POST['odometer']) ;$driveable = addslashes($_POST['driveable']) ;$title = addslashes($_POST['title']) ;$accidentflood = addslashes($_POST['accidentflood']) ;$price = addslashes($_POST['price']) ;if (!isset($_POST['email'])) {header( "Location: $formurl" );exit ;}$valid_email = (preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/im', $email)) ? true : false;$valid_firstname = (!empty($firstname)) ? true : false;$valid_zip = (!empty($zip)) ? true : false;$valid_phone = (!empty($phone1)) ? true : false;$valid_email = (!empty($email)) ? true : false;$valid_vin = (!empty($vin)) ? true : false;$valid_year = (!empty($year)) ? true : false;$valid_make = (!empty($make)) ? true : false;$valid_model = (!empty($model)) ? true : false;$valid_odometer = (!empty($odometer)) ? true : false;$fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process);}$messageproper ="This message was sent from:\n" ."$http_referrer\n" ."------------------------------------------------------------\n" ."Name: $firstname\n" ."Zip: $zip\n" ."Email: $email\n" ."Phone: $phone\n" ."Year: $year\n" ."Make: $make\n" ."Model: $model\n" ."Odometer: $odometer\n" ."Runs? $driveable\n" ."Title? $title\n" ."Accident or flood? $accidentflood\n" ."Expected pirce? $price\n" ."------------------------- MESSAGE -------------------------\n\n" .$comments ."\n\n------------------------------------------------------------\n" ;$headers = "From: \"$firstname\" <$fromemail>" . $headersep . "Reply-To: \"$firstname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;if ($valid_email && $valid_fname && $valid_zip && $valid_email && $valid_comments && $valid_year && $valid_make && $valid_model && $valid_odometer) {mail( $mailto, $subject, $messageproper, $headers );}else {header( "Location: $errorurl" );exit ;}header( "Location: $thankyouurl" );exit ;?> Any ideas of where I went wrong?
×
×
  • Create New...