virtuexru Posted November 13, 2006 Share Posted November 13, 2006 Solved, removing code. Link to comment https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/ Share on other sites More sharing options...
obsidian Posted November 13, 2006 Share Posted November 13, 2006 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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124059 Share on other sites More sharing options...
emehrkay Posted November 13, 2006 Share Posted November 13, 2006 <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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124064 Share on other sites More sharing options...
virtuexru Posted November 13, 2006 Author Share Posted November 13, 2006 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( '[email protected]' , "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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124085 Share on other sites More sharing options...
virtuexru Posted November 13, 2006 Author Share Posted November 13, 2006 Any help? Can't figure out why it won't put in the info :(? Link to comment https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124091 Share on other sites More sharing options...
Adika Posted November 13, 2006 Share Posted November 13, 2006 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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124092 Share on other sites More sharing options...
virtuexru Posted November 13, 2006 Author Share Posted November 13, 2006 Well those values all do exist. They are being pulled from a MySQL database, and then stored in the hidden function. But it still comes out blank on the second page. Maybe its not storing it correctly? Link to comment https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124098 Share on other sites More sharing options...
Adika Posted November 13, 2006 Share Posted November 13, 2006 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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124103 Share on other sites More sharing options...
virtuexru Posted November 13, 2006 Author Share Posted November 13, 2006 No, still empty values:User: is applying for job #. The users email is . The users resume can be found by clicking here: . Hmm... :\ I really have no idea I've thought of everything I know, still nothing works. Link to comment https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124108 Share on other sites More sharing options...
Adika Posted November 13, 2006 Share Posted November 13, 2006 Let's go page by page on this problem.If you would be so kind, put here the code that is displayed in your browser. I want to see, how the values are written on the html page. Link to comment https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124111 Share on other sites More sharing options...
trq Posted November 13, 2006 Share Posted November 13, 2006 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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124112 Share on other sites More sharing options...
emehrkay Posted November 13, 2006 Share Posted November 13, 2006 <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 https://forums.phpfreaks.com/topic/27139-email-submit-button-need-help-quick/#findComment-124113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.