Jump to content

In need of major PHP help!!


wizard3

Recommended Posts

I just got my own website again and I need help running a PHP. I guess it would be a mailer, but I dont think its set up right.

 

I'm using Dreamweaver and I have my table set up and ready to go. My problem is that I need help setting up the PHP so that when they hit the submit button, they get an echo of their order and its sent to me.

 

I got the email just fine, but for some reason the test I sent out came into my email blank.

 

Is there some command in Dreamweaver that I'm suppose to put with the order form that lets everything know its suppose to connect to the PHP? And I could really use the PHP code set up for me.

 

 

I'm a totally idiot when it comes to PHP, so any one that helps.... you're going to have to explain it in layman's terms, not in geek. Cause PHP is not a geek speak I understand very well.

 

Help please!!

Link to comment
Share on other sites

Uhm.. okay. Well, this is the form code...

 

<html>

<head>

 

<title>Tie Dye Order Form</title></head>

 

<body>

<form name="form1" method="post" action="">

  <table width="50%" border="0">

    <tr>

      <td width="18%">Name:</td>

      <td width="82%"><input name="name" type="text" id="name" size="30" maxlength="40"></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td>Colors:</td>

      <td><textarea name="colors" cols="30" id="colors"></textarea></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td>Pattern:</td>

      <td><input name="patterns" type="text" id="patterns" size="30" maxlength="40"></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td>Size:</td>

      <td><input type="text" name="textfield"></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td>Method of Payment:</td>

      <td><input type="text" name="textfield2">

        PayPal: were_cat3@hotmail.com</td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td height="21">Your Email:</td>

      <td><input name="textfield3" type="text" size="40"></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td>Shipment address:</td>

      <td><textarea name="textarea" cols="50" rows="8"></textarea></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td> </td>

      <td><input type="submit" name="Submit" value="Submit"></td>

    </tr>

  </table>

  </form>

</body>

</html>

 

 

 

 

And this is the code that I was given by my teacher a LONG while back... that I tried to modify...

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Your copy</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<?php

echo "<p>Name: $Name <br> Media: $Media <br> Colors: $Colors <br> Pattern: $Pattern <br> Size: $Size <br> Method of Payment: $Method <br> Email: $Email <br> Shipment: $Shipment";

$body="You have a new commission from $Name. \n $Colors \n $Pattern \n $Size \n $Method \n $Email \n $Shipment";

$to="blood_fire003@yahoo.com";

$subject="Tie-Dye!";

mail($to, $subject, $body);

?>

</body>

</html>

 

 

 

I know something is probably wrong now though...

Link to comment
Share on other sites

change

<?php
echo "<p>Name: $Name
Media: $Media
Colors: $Colors

etc

 

to

<?php
extract($_POST); //add this
echo "<p>Name: $Name
Media: $Media
Colors: $Colors

etc

 

a bettet solution is to add

$Name = $_POST['Name'];

etc etc

 

but in the script above extract will work

Link to comment
Share on other sites

I would also advise securing all variables that are passed across pages as they are subject to manipulation, this is expecially important when you start adding the data to SQL, due to sql injection, cross stite scripting, etc. etc.

 

A function to do exactly this is:

 

function clean($string) {

  $string = stripslashes($string);

  $string = htmlentities($string);

  $string = strip_tags($string);

  return $string;

}

 

Then you have assign all of the variables by using:

 

$username = clean($_POST[username]);

Link to comment
Share on other sites

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.