/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Link modifies php

This is the php and html for the form I have on the contact.php page of my website

[code=php]<?php
if (isset($_POST[‘submit’])) {
mail(“[email protected]”,”form contact”,”NAME: “.$_POST[‘fname’].” EMAIL: “.$_POST[’email’].”n———————-n MESSAGE:nn”.$_POST[‘message’]);
echo “<br /><br /><strong>Thank you for contacting Wiz Creations.</strong>n”;
} else {
?>
<form action=”contact.php” method=”post”>
<table align=”center” width=”300″ cellspacing=”5″ border=”0″>
<tr><td align=”center”>Your Name:<br /><input name=”fname” type=”text” value=”” size=”35″ /></td></tr>
<tr><td align=”center”>Your Email Address:<br /><input name=”email” type=”text” value=”” size=”35″ /></td></tr>
<tr><td align=”center”>Your Message:<br /><textarea name=”message” rows=”8″ cols=”40″></textarea></td></tr>
<tr><td height=”26″ align=”center”><input type=”submit” name=”submit” value=”Submit” />&nbsp;&nbsp;<input type=”reset” value=”Reset” /></td></tr>
</table>
</form>
<?php } ?>[/code]

I’m wondering if I can put a link on another page that comes to this and enters the text “Quote Submission: ” into the message textbox and changes the subject of the form from “form contact” to “quote submission”

Is this possible, and if so, how do I do it?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@pcthugAug 11.2006 — Change your php to match[code=php]<?php
if (isset($_POST['submit'])) {
mail("[email protected]",$_POST['subject'],"NAME: ".$_POST['fname']." EMAIL: ".$_POST['email']."n----------------------n MESSAGE:nn".$_POST['message']);
echo "<br /><br /><strong>Thank you for contacting Wiz Creations.</strong>n";

} else {
?>
<form action="contact.php" method="post">
<table align="center" width="300" cellspacing="5" border="0">
<tr><td align="center">Your Name:<br /><input name="fname" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Email Address:<br /><input name="email" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Message:<br /><textarea name="message" rows="8" cols="40"><?php echo $_GET['message']; ?></textarea></td></tr>
<tr><td height="26" align="center"><input type="submit" name="submit" value="Submit" />&nbsp;&nbsp;<input type="reset" value="Reset" /></td></tr>
<input type="hidden" name="subject" value="<?php echo (isset($_GET['subject'])) ? $_GET['subject'] : "form contact"; ?>" />
</table>
</form>
<?php } ?> [/code]
And then use the following link
http://www.wizcreations.com/mail.php?message=Quote+Submission%3A&amp;subject=quote+submission
Copy linkTweet thisAlerts:
@Wiz_CreationsauthorAug 11.2006 — Thanks. My laptop is off right now but I'll try that in the morning.
Copy linkTweet thisAlerts:
@Wiz_CreationsauthorAug 11.2006 — Thanks. Works flawlessly.
Copy linkTweet thisAlerts:
@Wiz_CreationsauthorAug 11.2006 — I tried setting up the same thing for the echo, but it doesn't work. I'm not sure what I'm doing wrong:
[code=php]<?php
if (isset($_POST['submit'])) {
mail("[email protected]",$_POST['subject'],"NAME: ".$_POST['fname']." EMAIL: ".$_POST['email']."n----------------------n MESSAGE:nn".$_POST['message']);
echo "<br /><br /><strong>"$_GET['reply']".</strong>n";
} else {
?>
<form action="contact.php" method="post">
<table align="center" width="300" cellspacing="5" border="0">
<tr><td align="center">Your Name:<br /><input name="fname" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Email Address:<br /><input name="email" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Message:<br /><textarea name="message" rows="8" cols="40"><?php echo $_GET['message']; ?></textarea></td></tr>
<tr><td height="26" align="center"><input type="submit" name="submit" value="Submit" />&nbsp;&nbsp;<input type="reset" value="Reset" /></td></tr>
<input type="hidden" name="subject" value="<?php echo (isset($_GET['subject'])) ? $_GET['subject'] : "Form Contact"; ?>" />
<input type="hidden" name="reply" value="<?php echo (isset($_GET['reply'])) ? $_GET['reply'] : "Thank you for contacting Wiz Creations"; ?>" />
</table>
</form>
<?php } ?> [/code]
Copy linkTweet thisAlerts:
@pcthugAug 12.2006 — Try this:
[code=php]
<?php
if (isset($_POST['submit'])) {
mail("[email protected]",$_POST['subject'],"NAME: ".$_POST['fname']." EMAIL: ".$_POST['email']."n----------------------n MESSAGE:nn".$_POST['message']);
echo "<br /><br /><strong>"$_POST['reply']".</strong>n";
} else {
?>
<form action="contact.php" method="post">
<table align="center" width="300" cellspacing="5" border="0">
<tr><td align="center">Your Name:<br /><input name="fname" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Email Address:<br /><input name="email" type="text" value="" size="35" /></td></tr>
<tr><td align="center">Your Message:<br /><textarea name="message" rows="8" cols="40"><?php echo $_GET['message']; ?></textarea></td></tr>
<tr><td height="26" align="center"><input type="submit" name="submit" value="Submit" />&nbsp;&nbsp;<input type="reset" value="Reset" /></td></tr>
<input type="hidden" name="subject" value="<?php echo (isset($_GET['subject'])) ? $_GET['subject'] : "Form Contact"; ?>" />
<input type="hidden" name="reply" value="<?php echo (isset($_GET['reply'])) ? $_GET['reply'] : "Thank you for contacting Wiz Creations"; ?>" />
</table>
</form>
<?php } ?> [/code]
Copy linkTweet thisAlerts:
@Wiz_CreationsauthorAug 12.2006 — Got it thanks! Had to change [color=blue]$_POST['reply'][/color] to [color=blue].$_POST['reply'].[/color]
×

Success!

Help @Wiz_Creations spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...