Click to See Complete Forum and Search --> : email button


adam2326
05-09-2009, 01:30 PM
Hi I currently have this form:

<form name="form1" id="form1" method="GET" action= "edit_bookings_action.php">
<label><span>Booking ID</span>
<input type="hidden" name="booking_id" value="<?php echo $row["booking_id"]; ?>" /><?php echo $row["booking_id"]; ?> />
</label>
<label><span>First Name</span>
<input type="text" name="first_name" id="first_name" class="input-text" value="<?php echo $row["first_name"]; ?>"/>
</label>
<label><span>Surname</span>
<input type="text" name="surname" id="surname" class="input-text" value="<?php echo $row["surname"]; ?>"/>
</label>
<label><span>Email</span>
<input type="text" name="email" id="email" class="input-text" value="<?php echo $row["email"]; ?>"/>
</label>
<label><span>School</span>
<input type="text" name="school" id="school" class="input-text" value="<?php echo $row["school"]; ?>"/>
</label>
<label><span>Address</span>
<input type="text" name="address" id="address" class="input-text" value="<?php echo $row["address"]; ?>"/>
</label>
<label><span>Town</span>
<input type="text" name="town" id="town" class="input-text" value="<?php echo $row["town"]; ?>"/>
</label>
<label><span>Postcode</span>
<input type="text" name="postcode" id="postcode" class="input-text" value="<?php echo $row["postcode"]; ?>"/>
</label>
<label><span>Contact Number</span>
<input type="text" name="number" id="number" class="input-text" value="<?php echo $row["number"]; ?>"/>
</label>
<label><span>Preferred Date of Workshop</span>
<input type="text" name="date" id="date" class="input-text" value="<?php echo $row["date"]; ?>"/>
</label>
<label><span>Notes</span>
<textarea name="notes" id="notes" cols="35" rows="10" value="<?php echo $row["notes"]; ?>"></textarea>
</label>
<div class="spacer"><input name="Amend" type="Submit" value="Amend" class="green"/><input name="Delete" type="Submit" value="Delete" />
</div>
</form>

I have been trying to create a button when if pushed will open up an email window which will be addressed to the email address displayed in the email field in the form. Does anyone know how to do this?

djjjozsi
05-09-2009, 01:51 PM
this form remind me an update form.

Create a button:

<input type="submit" name="sendmail" value="Compose Mail">

in edit_bookings_action.php lets build a mail form using the passed $_GET["email"]

schematic example:
if(isset($_GET["sendmail"]))
{
if(isset($_GET["Sendthemail"]))
{
build the mail function...
}
take the form for the message , in this form should use edit_bookings_action.php as an action
}

i suggest that use Post method insted of $_GET.

johanafm
05-15-2009, 11:30 AM
the answer is anchor, not button.

<a href="mailto:name@domain"><input type="button" value="Mail"/></a>

djjjozsi
05-15-2009, 12:05 PM
the answer is anchor, not button.

<a href="mailto:name@domain"><input type="button" value="Mail"/></a>


and the spam bots? its better to build a form (image activation + message ) and use a mail function.
for example: Url here (http://phpcode.hu/mail_generator/)

johanafm
05-15-2009, 01:02 PM
It depends entirely on where you use it. On an intranet for example, you don't need to care about that.

And if by image activation you refer to captcha, they aren't entirely secure. Either due to lousy implementation or through image processing. Sure, even if not fool proff, they do make things harder. But they are also annoying from a user persepective.

As such, it should be used only if necessary. And if you do need it, you'd hardly ask for how to open an external mail client, but rather how to deal with sending emails server side.

djjjozsi
05-15-2009, 01:15 PM
you're right johanafm.

@adam2326 you can change your code to make the mailto link like this:

this is the email field's line:

<label><span>Email (<?php printf("<a href=\"mailto:%s\">send </a>",$row["email"]);?>)</span>