Hello,
I have been tasked with adding a function to an existing program (that I did not write). I have some exposure to PHP, but it’s not much depth.
The short of it is; when status is changed to option value=“3” (which means the quote has been converted to a sale), the managers want to be alerted with an email.
Here is how it exists at present. I have not fooled much with it as it is a live page on our admin.
<strong>Update Quote:</strong><br><br>
<input type="hidden" name="qid" value="<?php echo $quoteinfo->fields['qid'];?>">
<input type="hidden" name="filename" value="<?php echo $quoteinfo->fields['filename'];?>">
<input type="hidden" name="email" value="<?php echo $quoteinfo->fields['email'];?>">
<?php if($quoteinfo->fields['status']!='-1') { ?>
Status: <select name="status" id="status">
<option value="-1" <?php if($quoteinfo->fields['status']=='-1') { ?> selected <?php } ?>><?php echo QUOTE_STATUS_1;?></option>
<option value="0" <?php if($quoteinfo->fields['status']=='0') { ?> selected <?php } ?>><?php echo QUOTE_STATUS_2;?></option>
<option value="1" <?php if($quoteinfo->fields['status']=='1') { ?> selected <?php } ?>><?php echo QUOTE_STATUS_3;?></option>
<option value="2" <?php if($quoteinfo->fields['status']=='2') { ?> selected <?php } ?>><?php echo QUOTE_STATUS_4;?></option>
<option value="3" <?php if($quoteinfo->fields['status']=='3') { ?> selected <?php } ?>><?php echo QUOTE_STATUS_5;?></option>
</select><br>
<?php } ?>
Follow-up: <input type="text" name="followup-date" id="followup-date" value="<?php echo $quoteinfo->fields['followup_date']!='' ? date('n/j/Y',$quoteinfo->fields['followup_date']) : date('n/j/Y');?>"><input type="button" name="clear" value="clear" onClick="document.getElementById('followup-date').value='';">
<textarea name="comments" rows="4"></textarea><br><br>
<?php if($quoteinfo->fields['status']=='-1') { ?>
<?php if($quoteinfo->fields['approval']!='1') { ?>
<input type="submit" value="Place Comment" name="update-quote">
<input type="submit" value="Approve Quote" name="update-quote">
<input type="submit" value="Remove Quote" name="update-quote">
<?php } else { ?>
<span style="color:red;">* Requires approval from management.</span><br><br>
<input type="submit" value="Place Comment" name="update-quote">
<input type="submit" value="Approve Quote" name="update-quote" <? if($admin_name->fields['admin_name']!='rjordan' && $admin_name->fields['admin_name']!='gschlatter' && $admin_name->fields['admin_name']!='admin' && $admin_name->fields['admin_name']!='lhoneycutt') { ?> disabled<?php } ?>>
<input type="submit" value="Remove Quote" name="update-quote">
<input type="hidden" name="approver" value="<?php echo $_SESSION['admin_name'];?>"/>
<?php } ?>
<?php } else { ?>
<input type="submit" value="Update Quote" name="update-quote">
<?php } ?>
<input type="button" onClick="window.location='quotes.php?page=<?php echo $_GET['page'];?>'" value="back">
My instinct is that I will need an if statement somehow in conjunction with the submit button - but not entirely clear how to integrate that. Any help to get me pointed in the right direction or at some good sample code would be greatly appreciated.
Thanks.
Max
