php form

mattiasb

New Member
Hey I'd like to incorporate telephone number in my form. I tried just to add fields in the form and what I thought was the right code in the php file too, but didnt work. the form works well with all other info though.
What code do I need to add phone number and a dropdown with multiple choices?
 

mattiasb

New Member
thanx, but I dont want to use MySQL at this stage, I just want to make a mailform with dropdown choices and spaces to fill in a telephone number. I have already made a mailform that is working good, but without the dropdown and phone in it. tried to do phone but didn't work. it's probably v v easy.
Not sure about what php commands to use
 

conor

New Member
Oh sorry I misunderstood your question. If you could post the code of your existing form then I can show you how to expand on that.
 

mattiasb

New Member
<h1><a>Untitled Form</a></h1>
<form id="form_19334" class="appnitro" method="post" action="send_form">
<div class="form_description">
<h2>Untitled Form</h2>
<p>This is your form description. Click here to edit.</p>
</div>
<ul >

<li id="li_1" >
<label class="description" for="element_1">first name </label>
<div>
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_2" >
<label class="description" for="element_2">surname </label>
<div>
<input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_3" >
<label class="description" for="element_3">subject </label>
<div>
<select class="element select medium" id="element_3" name="element_3">
<option value="" selected="selected"></option>
<option value="1" >english language course</option>
<option value="2" >foreign language course</option>
<option value="3" >translation</option>
<option value="4" >interpretation</option>
<option value="5" >vacancies</option>
<option value="6" >other</option>

</select>
</div>
</li> <li id="li_4" >
<label class="description" for="element_4">language </label>
<div>
<select class="element select medium" id="element_4" name="element_4">
<option value="" selected="selected"></option>
<option value="1" >arabic</option>
<option value="2" >bulgarian</option>
<option value="3" >croatian</option>
<option value="4" >dutch</option>
<option value="5" >english</option>
<option value="6" >french</option>
<option value="7" >german</option>
<option value="8" >greek</option>
<option value="9" >hungarian</option>
<option value="10" >italian</option>
<option value="11" >japanese</option>
<option value="12" >kiswahili</option>
<option value="13" >mandarin</option>
<option value="14" >norwegian</option>
<option value="15" >polish</option>
<option value="16" >portuguese</option>
<option value="17" >russian</option>
<option value="18" >slovenian</option>
<option value="19" >spanish</option>
<option value="20" >swedish</option>
<option value="21" >turkish</option>

</select>
</div>
</li> <li id="li_5" >
<label class="description" for="element_5">message </label>
<div>
<textarea id="element_5" name="element_5" class="element textarea small"></textarea>
</div>
</li> <li id="li_6" >
<label class="description" for="element_6">email </label>
<div>
<input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_7" >
<label class="description" for="element_7">phone </label>
<span>
<input id="element_7_1" name="element_7_1" class="element text" size="3" maxlength="3" value="" type="text"> -
<label for="element_7_1">(###)</label>
</span>
<span>
<input id="element_7_2" name="element_7_2" class="element text" size="3" maxlength="3" value="" type="text"> -
<label for="element_7_2">###</label>
</span>
<span>
<input id="element_7_3" name="element_7_3" class="element text" size="4" maxlength="4" value="" type="text">
<label for="element_7_3">####</label>
</span>

</li>

<li class="buttons">
<input type="hidden" name="form_id" value="19334" />

<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
<div id="footer">
Generated by <a href="http://www.phpform.org">pForm</a>
</div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
</html>



a lot of code...this is not the form I have now, but the way I want it to be.
I dont have the php methodfile for the above code..
 

conor

New Member
So let me get it straight. You want to gather information from this form and send it in an email.

Code:
<?php

if(isset($_POST['submit'])){

    $element1 = $_POST['element1'];
    $element2 = $_POST['element2'];
    $element3 = $_POST['element3'];

    $body = "element1 = $element1 \n element2 = $element2 \n element3 = $element3";
    $recipient = '[email protected]';
    $subject = 'Sample Form';

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

    echo 'mail sent';

}

?>
 

conor

New Member
The code to add to that form for a customer phone is:

Code:
<tr>
<td>Phone Number</td>
<td>:</td>
<td><textarea name="phone" cols="50" rows="4" id="detail"></textarea></td>
</tr>

What do you want to do with the phone number then? Do you want to send it as part of the email?

What do you mean by two dropdowns?
 

DimitriDV

New Member
PHP:
<td>Phone Number</td>
<td>:</td>

:D

Keep It Simple:

PHP:
<td>Phone Number :</td>



@threadstarter: google for php form
 

mattiasb

New Member
php

I just need two dropdowns added, and then the php code to make it work, sending it to the mail I have chosen.
making the table is not the problem, but making the php-form to send the information the customer has chosen in the dropdown and the phone..
I tried just adding phone in the php like this:


<tr>
<td>phone</td>
<td>:</td>
<td><input name="phone" type="text" id="phone" size="50"></td>
</tr>

and in the php send_contact file like this

// From
$phone="from: $phone <$phone>";

$send_contact=mail($to,$subject,$message,$header,$phone);

//etc.


like in this example: http://www.phpeasystep.com/phptu/8.html


didnt work, and then I'd like two dropdown menus too, with the possibility to choose from different products, as in the code I posted earlier..

Appreciate all help!
 

mattiasb

New Member
This is the code of the form.
What I miss is the correct "send_form.php" to accompany it

thanx again!


<!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=UTF-8">
<title>Untitled Form</title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>

</head>
<body id="main_body" >

<img id="top" src="top.png" alt="">
<div id="form_container">

<h1><a>Untitled Form</a></h1>
<form id="form_19334" class="appnitro" method="post" action="send_form">
<div class="form_description">
<h2>Untitled Form</h2>
<p>This is your form description. Click here to edit.</p>
</div>
<ul >

<li id="li_1" >
<label class="description" for="element_1">first name </label>
<div>
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_2" >
<label class="description" for="element_2">surname </label>
<div>
<input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_3" >
<label class="description" for="element_3">subject </label>
<div>
<select class="element select medium" id="element_3" name="element_3">
<option value="" selected="selected"></option>
<option value="1" >english language course</option>
<option value="2" >foreign language course</option>
<option value="3" >translation</option>
<option value="4" >interpretation</option>
<option value="5" >vacancies</option>
<option value="6" >other</option>

</select>
</div>
</li> <li id="li_4" >
<label class="description" for="element_4">language </label>
<div>
<select class="element select medium" id="element_4" name="element_4">
<option value="" selected="selected"></option>
<option value="1" >arabic</option>
<option value="2" >bulgarian</option>
<option value="3" >croatian</option>
<option value="4" >dutch</option>
<option value="5" >english</option>
<option value="6" >french</option>
<option value="7" >german</option>
<option value="8" >greek</option>
<option value="9" >hungarian</option>
<option value="10" >italian</option>
<option value="11" >japanese</option>
<option value="12" >kiswahili</option>
<option value="13" >mandarin</option>
<option value="14" >norwegian</option>
<option value="15" >polish</option>
<option value="16" >portuguese</option>
<option value="17" >russian</option>
<option value="18" >slovenian</option>
<option value="19" >spanish</option>
<option value="20" >swedish</option>
<option value="21" >turkish</option>

</select>
</div>
</li> <li id="li_5" >
<label class="description" for="element_5">message </label>
<div>
<textarea id="element_5" name="element_5" class="element textarea small"></textarea>
</div>
</li> <li id="li_6" >
<label class="description" for="element_6">email </label>
<div>
<input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_7" >
<label class="description" for="element_7">phone </label>
<span>
<input id="element_7_1" name="element_7_1" class="element text" size="3" maxlength="3" value="" type="text"> -
<label for="element_7_1">(###)</label>
</span>
<span>
<input id="element_7_2" name="element_7_2" class="element text" size="3" maxlength="3" value="" type="text"> -
<label for="element_7_2">###</label>
</span>
<span>
<input id="element_7_3" name="element_7_3" class="element text" size="4" maxlength="4" value="" type="text">
<label for="element_7_3">####</label>
</span>

</li>

<li class="buttons">
<input type="hidden" name="form_id" value="19334" />

<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
<div id="footer">
Generated by <a href="http://www.phpform.org">pForm</a>
</div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>
</html>
 
Top