Jump to content

Email Submit button - need help quick!


virtuexru

Recommended Posts

You are attempting to modify PHP script with javascript, which is impossible. You have to handle [b]all[/b] PHP scripting with the mindset that once the page is displayed, it is [b]all[/b] parsed already. What you need to do is use that button to send the form to a processing page which then redirects the user to a success.php page upon successful processing of the form.
Link to comment
Share on other sites

<form action = "success.php> method ="post">
<input type="hidden" name = "user" value = "<?php $_SESSION['results'][fullname]; ?>" />
etc...
<input type='submit" value = "submit" />

no on the next page grab the post values

$message = "User: ". $_POST['user'] blah blah blah...

mail($to,$subject,$message);
Link to comment
Share on other sites

Thanks for the help, I understand what I need to do but for some reason it won't grab values.

[b]First page has this code:[/b]

[quote]
<form action = "applyprocess.php" method ="post">
<input type="hidden" name="user" value = "<?php $_SESSION['results'][fullname]; ?>" />
<input type="hidden" name="id" value = "<? $id ?>" />
<input type="hidden" name="useremail" value = "<? $_SESSION['results'][email]; ?>" />
<input type="hidden" name="resumelink" value = "<? $html ?>" />
<input type="hidden" name="recruit" value = "<? $myrow["email"]; ?>"
<input type="submit" value = "submit" value="Confirm" />

[/quote]

[b]second page code:[/b]

[quote]
<?
$user = $_POST['user'];
$id = $_POST['id'];
$email = $_POST['useremail'];
$html = $_POST['resumelink'];
$remail = $_POST['recruit'];
?>


<?
$confirmation = "Your job application to job #".$id." has been submitted succesfully to one of our recruiters. Thank you for your submittal, we will be getting back to you shortly.";
$message = "<html><body>User:".$user." is applying for job #".$id.". The users email is ".$email.". <br/>The users resume can be found by clicking here: ".$html.".</body></html>";
if
(mail( 'xx.xx@xx.com' , "Job Application for JO#".$id.".", $message, "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"))
{ echo "Job application processed succesfully.";
}
else
{ echo "Error.";
}
if
(mail( $email , "Job Application Confirmation for JO#".$id.".", $confirmation, "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"))
{ echo "<p/>Confirmation sent.";
}
else
{ echo "Error.";
}
?>

[/quote]
Link to comment
Share on other sites

On the first page, you must allow users to enter data. Don't use only hidden fields in forms, because it will look wierd on page. Imagine a page were you only see a submit button, and when you press it, it shows you some message and redirects you somewhere else. It sounds good, but the user can't see anything around button, and he doesn't know what that button is for. That's why you need to ask some data from a user and then send that data to page 2 for processing.


On the second page, you are using one GET method page which on first page doesn't exist. To have a GET value in the first page, you must add:

<form action="applyprocess.php[color=red]?user='me'[/color]" method="post">


Then, you can use the
$user = $_GET['user'];


I think that the biggest problem is that you are submitting the form from your first page with empty values, because those hidden values must exist in your script somewhere, or the hidden values will be empty. Check you code from the first page in your browser to see what values does the hidden fields have.
Link to comment
Share on other sites

I just remember the solution!!!!


Put:

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

before $user = $_POST['user']; in the second page, and put an extra } at the end of that page.


You have one mistake on your first page:


<form action = "applyprocess.php" method ="post">
                  <input type="hidden" name="user" value = "<?php $_SESSION['results'][fullname]; ?>" />
                  <input type="hidden" name="id" value = "<? $id ?>" />
                  <input type="hidden" name="useremail" value = "<? $_SESSION['results'][email]; ?>" />
                  <input type="hidden" name="resumelink" value = "<? $html ?>" />
                  <input type="hidden" name="recruit" value = "<? $myrow["email"]; ?>"
                  <input type="submit" [color=red]value[/color]="submit" value="Confirm" />

The red value must be changed to name:

[code]
<form action = "applyprocess.php" method ="post">
                  <input type="hidden" name="user" value = "<?php $_SESSION['results'][fullname]; ?>" />
                  <input type="hidden" name="id" value = "<? $id ?>" />
                  <input type="hidden" name="useremail" value = "<? $_SESSION['results'][email]; ?>" />
                  <input type="hidden" name="resumelink" value = "<? $html ?>" />
                  <input type="hidden" name="recruit" value = "<? $myrow["email"]; ?>"
                  <input type="submit" name="submit" value="Confirm" />
[/code]

Is it working now?
Link to comment
Share on other sites

Your code is very inconsistant. Are you sure you have short tags enabled? Your much better off sticking to long tags anyway or at least being consistant and sticky to one or the other.

Also, your quoting some array indexes but not others... why? Use...

[code=php:0]
$_SESSION['results']['email']
[/code]

instead of...

[code=php:0]
$_SESSION['results'][email]
[/code]

I dont think this is the cause of any of your problems, but its best practice anyway. Ide have a go at the way you indent / format your code too but it appears you love to be the odd one out. :)
Link to comment
Share on other sites

<form action = "applyprocess.php" method ="post">
                  <input type="hidden" name="user" value = "<?php $_SESSION['results'][fullname]; ?>" />
                  <input type="hidden" name="id" value = "<? $id ?>" />
                  <input type="hidden" name="useremail" value = "<? $_SESSION['results'][email]; ?>" />
                  <input type="hidden" name="resumelink" value = "<? $html ?>" />
                  <input type="hidden" name="recruit" value = "<? $myrow["email"]; ?>"
                  <input type="submit" value = "submit" value="Confirm" />


you need to chnage all of the value ="<?php $var ?>"
to
<?php echo $var ?>
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.