Jump to content

Recommended Posts

Guys please I need help. My page www.newcomputech.net/servicerequest.php is not working probably. I fed up trying and I don't really know what's wrong with my script. sometimes I receive emails when you submit and sometimes not.

 

Any clue!!

 

Thanks.

 

Moe

Link to comment
https://forums.phpfreaks.com/topic/190573-any-help-will-be-much-appreciated/
Share on other sites

Guys please I need help. My page www.newcomputech.net/servicerequest.php is not working probably. I fed up trying and I don't really know what's wrong with my script. sometimes I receive emails when you submit and sometimes not.

 

Any clue!!

 

Thanks.

 

Moe

 

... we can't see your PHP code just by looking at your page or its source.  You'll need to post your code here if you want anyone to help.  Please be sure to use BBCode code tags when you do.

Here is my coding:

 

<?php

/**

* @author Dennis Degryse <dennisdegryse@gmail.com>

*

* @date 2009, Oct 1

*/

 

// Includes the template

 

 

include_once("template.php");

 

 

$method = "normal";

 

function getPostVariable($name) {

$value = $_POST[$name];

 

return htmlentities($value);

}

 

function sendMail() {

$subject = 'Online Service Calls!';

$to = 'm.newcomputech@gmail.com';

 

$body  = "<br /><hr /><br />";

$body .= "Company: " . getPostVariable("company_name") . "<br />";

$body .= "Contact: " . getPostVariable("contact_name") . "<br />";

$body .= "Phonenumber: " . getPostVariable("phone_number") . "<br />";

$body .= "Address: " . getPostVariable("address") . "<br />";

$body .= "City: " . getPostVariable("city") . "<br />";

$body .= "State: " . getPostVariable("state") . "<br />";

$body .= "Zip: " . getPostVariable("zip") . "<br />";

$body .= "Email: " . getPostVariable("email") . "<br />";

$body .= "Servicefor: " . getPostVariable("service_for") . "<br />";

$body .= "Model: " . getPostVariable("model") . "<br />";

$body .= "Warranty: " . getPostVariable("warranty_status") . "<br />";

$body .= "Serviceby: " . getPostVariable("service_needed_by") . "<br />";

$body .= "Details: " . getPostVariable("service_details") . "<br />";

$body .= "Client: " . getPostVariable("new_client") . "<br />";

 

$headers  = "From: " . getPostVariable("email") . " \r\n";

$headers .= "Content-type: text/html \r\n";

 

$success = mail($to, $subject, $body, $headers);

}

 

if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["service_call"] == "Submit") {

sendMail();

$method = "sent";

}

 

// Overrides the css properties

$bg_image = "12.gif";

 

// Prints the page

template_print();

 

/**

* Contains the actual content of the page. This function will be

* called from the template. It doesn't matter where you define this

* function, as long as it's present in every page that uses the

* template. If you don't define it, the template will print no con-

* tent. If you program echo's or other output outside this function

* it will print it before or after the template, which will result

* in a non-proper webpage.

*/

function template_content() {

global $method;

// It's perfectly safe to enter XHTML code outside the php tags.

// Just make sure it stays within the function.

?>

<h1>Service Call Form</h1>

 

<?php

if ($method == "normal") {

?>

<div class="form">

<div class="field">

<label for="inp_company_name">Company Name</label>

<input type="text" id="inp_company_name" name="company_name" />

</div>

<div class="field">

<label for="inp_contact_name">Contact \ Name</label>

<input type="text" id="inp_contact_name" name="contact_name" />

</div>

<div class="field">

<label for="inp_phone_number">Phone Number</label>

<input type="text" id="inp_phone_number" name="phone_number" />

</div>

<div class="field">

<label for="inp_address">Address</label>

<input type="text" id="inp_address" name="address" />

</div>

<div class="field">

<label for="inp_city">City</label>

<input type="text" id="inp_city" name="city" />

</div>

<div class="field">

<label for="inp_state">State</label>

<input type="text" id="inp_state" name="state" />

</div>

<div class="field">

<label for="inp_zip">ZIP</label>

<input type="text" id="inp_zip" name="zip" />

</div>

<div class="field">

<label for="inp_email">E-mail</label>

<input type="text" id="inp_email" name="email" />

</div>

<div class="field">

<label for="inp_service_for">Service For</label>

<select id="inp_service_for" name="service_for">

<option>Printer</option>

<option>Laptop</option>

<option>Desktop Computer</option>

<option>Network</option>

<option>Others</option>

</select>

</div>

<div class="field">

<label for="inp_model">Model (Optional)</label>

<input type="text" id="inp_model" name="model" />

</div>

<div class="field">

<label for="inp_warranty_status">Warranty Status (If known)</label>

<input type="text" id="inp_warranty_status" name="warranty_status" />

</div>

<div class="field">

<label for="inp_service_needed_by">Service Needed By</label>

<input type="text" id="inp_service_needed_by" name="service_needed_by" />

</div>

<div class="field">

<label for="inp_service_details">Service Details</label>

<textarea lines="5" id="inp_service_details" name="service_details"></textarea>

</div>

<div class="field">

<label for="inp_new_client_yes">New Client?</label>

<label for="inp_new_client_yes">Yes</label>

<input type="radio" id="inp_new_client_yes" name="new_client" value="yes" />

<label for="inp_new_client_no">No</label>

<input type="radio" id="inp_new_client_no" name="new_client" value="no" />

</div>

<div class="field">

<input type="submit" id="inp_service_call" name="service_call" value="Submit" />

</div>

</div>

<?php

} elseif ($method == "sent") {

?>

<p>

Your message has been sent.

</p>

<?php

}

}

?>

 

 

 

 

I also attached the file.

 

I really do need help guys.

 

[attachment deleted by admin]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.