Jump to content

Hatdrawn

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Hatdrawn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you. Sending it to a third page should fix the problem so I don't have to add those if statements.
  2. Is the question I'm asking not clear? Or is the problem not clear? Or can no one figure it out? Any kind of help would be useful.
  3. Thanks but no. I need it to keep adding values, that will just repeatedly replace the values.
  4. Not 100% sure but I think it may have to do with the way you set up the field for that in mySQL
  5. the " .= " adds to the current information in the variable http://www.w3schools.com/PHP/php_operators.asp
  6. I'll try to explain best I can, let me know if I'm not clear please. I created an array $arr_email = array(); then I have an if statement that does several things, everything works, but the focus is adding to the array $arr_email. if($_POST['Submit_Auto'] || !$_POST['Email_Auto']){ echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"><table class="verify"><tr><td><h3 style="margin-bottom:5px;">Auto Insurance Form</h3></td></tr><tr><td style="margin:0;padding:0;font-size:smaller;font-style:italic;">Please verify your information</td></tr>'; foreach($_POST as $var => $value) { if(in_array($var, $arr_auto)){ echo '<tr>'; echo '<td class="output">'.$var . '</td><td><span class="userInput">' . $value . '</span></td>'; $arr_email[$var] .= $value; } echo '</tr>'; } print_r($arr_email); echo '<tr><td><input type="button" value="Go Back" onclick="history.go(-1);return true;"/></td><td><input type="submit" name="Email_Auto" value="Request Quote"/></td></tr></table></form>'; } I have a page that displays the information from a form on the page before. This works fine. I added a submit button to accept this information and send it. The submit button is in a form that has the action $_SERVER['PHP_SELF'] the name of the submit button is Email_Auto. Now i have a following else/if statement where I try to access $arr_email because I use it to create the body of my email. else if($_POST['Email_Auto']){ $to = "vian@interactivesanctuary.com"; $headers = "From: Think!nsure Auto Insurance Form"; $subject = "Auto Insurance Quote Request"; $body = "The user submitted the following:\n\n"; foreach($arr_email as $var => $value){ if(in_array($var, $arr_auto)){ $body .= sprintf("%20s : %s\n",$var,$value); } } if (mail($to, $subject, $body, $headers)) { echo("<p>Message successfully sent!</p>".$body); print_r($arr_email); } else { echo("<p>Message delivery failed...</p>".$body); print_r($arr_email); } } The print_r($arr_email); in the if statement shows me what I want and the others do not, so it seems that once I hit the Email_Auto submit it clears the array. I might have a very wrong idea of what's going on here. I get the emails, but they only have the default body. Please help and please forgive me if I'm a complete idiot. I can post all the php if necessary but this is all the relevant php. Thanks, Hatdrawn
  7. So what is wrong with this technique? It's the only solution I could find.
  8. foreach($_POST as $var => $value) { $n=0; if(in_array($var, $arr_auto)){ echo $var . ' : ' . $value . "<br>"; } $n++; } This is what I wanted, thought I'd post for someone elses reference
  9. How would I build a function that would test each key of one associative array to all the values of another arry? This is what I have, quite clearly not it but hey, I'm trying foreach($_POST as $var => $value) { $n=0; if($var == $arr_auto[$n]){ echo $var . ' : ' . $value . "<br>"; } $n++; }
  10. I'm not an expert and I also can't really understand the issue but does this help? <td align="center"><?php if ($recordsFound){ echo \'<a href="update_general.php?recordID=$row_current[\'cls_id\'] &cls_item_var=$row_current[\'cls_item\']">Update</a>';}?></td>
  11. I have a novice understanding of PHP and I need some help I'm taking over a site that had some forms already built and I need a build a page to verify them. The verification is going to to be as simple as displaying what the user entered and asking if it's right, I won't be doing any error checking. On the initial page there is a hidden input with the name="Fields2Email_auto" and value="MyName,Address..." (all the values of the rest of the fields). So on the second page all I'm trying to do is display these values, as what the user typed in. I put them in an array... $array=explode(',', $Fields2Email_auto); ... hoping a I could loop all the values of the array into $_POST. I can't seem to figure it out. I really don't want to manually type in $MyName = $_POST['MyName'] for the some 300 fields over the 5 pages. Please help. All I'm trying to do is automate the proces of $MyName = $_POST['MyName']
×
×
  • 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.