sspoke Posted February 17, 2007 Share Posted February 17, 2007 it posts so it works.. lol now you have to add all your posts.. on very top of the page <?php $one = $_POST['whateverone']; $twowhatever = $_POST['whatever']; $store = $_POST['storename']; ?> to global them after page reloads than at the very bottom of the page add your functions for mysql or flat files whatever you use Quote Link to comment Share on other sites More sharing options...
signature16 Posted February 17, 2007 Author Share Posted February 17, 2007 Here is the entire script start to finish; The varibles are defined: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="css/publicadd.css"> <title>Add Yourself or Your Clinic to The PRRT Practitioner Locater System</title> <script type="text/javascript" src="http://www.theprrt.com/scripts/prototype.js"></script> <script type="text/javascript" src="http://www.theprrt.com/scripts/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="http://www.theprrt.com/scripts/lightbox.js"></script> <link rel="stylesheet" href="http://www.theprrt.com/scripts/lightbox.css" type="text/css" media="screen" /> </head> <body> <? echo $_POST['storename']; ?> <div id="header"></div> <div id="content"> <div id="contentInside"> <? require_once "phpGoogleStoreLocator-inc.php"; ?> <? /*if (can_submit_location() >= get_setting('user_location_submision_limit', $db)) { echo '<div style="padding:20px;">Limit Reached. Please email bwilson@theprrt.com if you still need to enter your information.</div>'; exit; }*/ ?> <? //If we got a post, process it. if ($_POST['submit']) { update_submit_location(); //Initialize local vars to make reading easier on the eyes and cleaner code $address = addslashes($_POST['street']); $city = addslashes($_POST['city']); $state = addslashes($_POST['state']); $zip = addslashes($_POST['zip']); $storename = addslashes($_POST['storename']); $hours = addslashes($_POST['hours']); $url = addslashes($_POST['url']); $notes = addslashes($_POST['notes']); $image = addslashes($_POST['image']); $image_url = addslashes($_POST['image_url']); $phone = addslashes($_POST['phone']); $use_coordinate = addslashes($_POST['use_coordinate']); $icon = addslashes($_POST['icon']); $emailConfirm = addslashes($_POST['emailConfirm']); $coordinates = get_lat_lon($_POST, ''); $coordinates = split('##', $coordinates); $lat = $coordinates[0]; $lon = $coordinates[1]; //Clean up the Notes var. Javascript cant handle \n or \r, so we replace them with <br>'s. You will get \r\n //if you hit enter in ANY html textarea, so this little hack fixes that problem. You will also notice that in the //html below, I reverse it and change <br> to \r\n. This is so it looks the right way when you look at it in the //textarea field. $notes = str_replace("\r\n", "<br>", $notes); //Clean up the web fields that had http:// in them. if ($url == "http://") { $url = ''; } if ($image_url == "http://") { $image_url = ""; } //Make sure the State and City name are capitolized, otherwise google pukes on some address. Stupid Google. $city = ucwords($city); if (strlen($state) > 2) { $state = ucwords($state); } else { $state = strtoupper($state); } //Check to see if this is even a valid address by looking at what yahoo spit back at us if (!$lat || !$lon) { $msg .= "This address appears to be invalid.<br>"; $error = 1; } //Check for any required fields that were missing (For now just the zip since thats all thats physically needed.) if ($zip == '') { $msg .= "All locations must contain a zipcode. Please enter a Zipcode.<br>"; $error = 1; } if ($storename == '') { $msg .= "All locations must contain a Name. Please enter a Name.<br>"; $error = 1; } //See if this address already exists, if not, enter it. // if (location_exists($lat, $lon, $db)) //{ ///$msg .= "This Location already exists.<br>"; // $error = 1; //} //If there were no errors, do yer duty and enter it. if (!$error) { //If it was entered, tell them about it $expiration_date = get_default_expiration(); $id = insert_location($address, $city, $state, $zip, $country, $storename, $hours, $url, $notes, $image, $image_url, $phone, $lat, $lon, $icon, $categories, $use_coordinate, $expiration_date, $db); echo "<br /><img src=\"images/success.gif\"<br />$address, $city, $state $zip"; $body = "A New map location has been entered. Below is information about it.\n\n"; $body .= "ID: $id"; $body .= "Address: $address\n"; $body .= "City: $city\n"; $body .= "State: $state\n"; $body .= "Zip: $zip\n"; $body .= "Country: $country\n"; $body .= "Name: $storename\n"; $body .= "Hours: $hours\n"; $body .= "URL: $url\n"; $body .= "Notes: $notes\n"; $body .= "Image: $image\n"; $body .= "Image URL: $image_url\n"; $body .= "Phone: $phone\n"; $body .= "Lat: $lat\n"; $body .= "Lon: $lon\n"; $body .= "Icon: $icon\n"; $body .= "Use Coordinate: $use_coordinate\n"; $body .= "Expiration Date: $expiration_date\n"; mail(get_setting('admin_email', $db), 'New Map Location Submission', $body); $headersConfirm = "From: \"SuperSpine, Inc.\"<info@theprrt.com>\n" ; $headersConfirm .= "Reply-To:info@theprrt.com\r\n" ; $bodyConfirm = "Thank you for submitting your information to ThePRRT Referral Program."; $bodyConfirm .= "Please make sure the following information is correct:\n\n"; $bodyConfirm .= "Name: $storename\n"; $bodyConfirm .= "Hours: $hours\n"; $bodyConfirm .= "Address: $address\n"; $bodyConfirm .= "City: $city\n"; $bodyConfirm .= "State: $state\n"; $bodyConfirm .= "Zip: $zip\n"; $bodyConfirm .= "Country: $country\n"; $bodyConfirm .= "If you have any questions please email craig@theprrt.com"; mail($emailConfirm, 'PRRT Referral Confirmation Email', $bodyConfirm, $headersConfirm); //Clean out the vars so that they dont display in the form again. $address = ''; $city = ''; $state = ''; $zip = ''; $storename = ''; $hours = ''; $url = ''; $notes = ''; $image = ''; $image_url = ''; $phone = ''; $lat = ''; $lon = ''; } if($error) { echo '<img src="images/error.gif">' . "<br />"; echo "$msg"; } } ?> <div> <?php //Start Instructions Section ?> <div style="margin:20px 0 20px 0;"> <p>Thank you for purchasing a spot in ThePRRT™ Practitioner Directory! Follow the simple instructions below to submit your information. When PRRTPatient.com is launched patients will be able to find your contact information by typing in their zip code or postal code (Canada). </p> </div> <div style="margin:20px 0 20px 0;"> <p><img src="images/instructions.gif" alt="Instructions" /></p> <ol> <li>Fill out the following information. The information you provide below will be displayed on PRRTPatient.com.</li> <li>To see exactly where each field appears on the locater program, please click the "Help!" link on the right hand side. </li> <li>Your information will be available to patients after it has been verified. </li> </ol> </div> </div> <?php //End Instructions Section ?> <p><img src="images/add-entry.gif" alt="Add Entry" /></p> <form method="POST" action="publicadd.php"> <table border=0> <tr> <td colspan="6"><strong>General Information:</strong> </td> </tr> <tr> <td width="131">Name:</td> <td width="144"><input type=text name='storename' value='<? echo $storename; ?>' /> </td> <td width="221" colspan="4" align=right valign="top"><a href="images/public-add/name.gif" rel="lightbox" title="Personal Name"><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>Phone:</td> <td><input type="text" name='phone' value='<? echo $phone; ?>' /></td> <td colspan="4" align=right valign="top"><a href="images/public-add/phone.gif" rel="lightbox" title="Phone Number"><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>Hours:</td> <td> <input type="text" name='hours' value="<? echo $hours; ?>" /> </td> <td colspan="4" align="right" valign="top"><a href="images/public-add/hours.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>Email:</td> <td> <input type="text" name="emailConfirm" value="<? echo $emailConfirm; ?>" /> </tr> <tr> <td colspan="6"><br /><strong>Address:</strong></td> </tr> <tr> <td>Street Address:</td> <td><input type=text name='street' value='<?php echo $address; ?>' /></td> <td colspan="4" align=right valign="top"><a href="images/public-add/street-address.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>City</td> <td><input type=text name='city' value='<?php echo $city; ?>' /></td> <td colspan="4" align=right valign="top"><a href="images/public-add/city-state-zip.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>State:</td> <td><input type=text name='state' value='<? echo $state; ?>' /></td> <td colspan="4" align=right valign="top"><a href="images/public-add/city-state-zip.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>Zip Code: </td> <td><input type=text name='zip' value='<? echo $zip; ?>' /></td> <td colspan="4" align=right valign="top"><a href="images/public-add/city-state-zip.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a> </td> </tr> <tr> <td>Country:</td> <td><? echo show_country_codes(); ?></td> <td colspan="4" align=right valign="top"><a href="images/public-add/city-state-zip.gif" rel="lightbox" title=""><img alt="" src="images/help.gif"/></a></td> </tr> <tr> <td> </td> <td> <input type="image" src="images/submit.gif" style="width:104px; height:24px; margin-top:15px;" name="submit" value="Submit Location" /></td> <td colspan="4"></td> </tr> </table> </form> <div style="text-align:center;"> <div style="margin:auto; width:100%; font-size:80%; text-align:center;">***All entries will be verified before they are appear on the website. *** </div> </div> </div> </div> </div> </div> <div id="footer"></div></body></html> Quote Link to comment Share on other sites More sharing options...
sspoke Posted February 17, 2007 Share Posted February 17, 2007 O lol I forgot!! your using image inputs which means when you click that submit image it doesn't send submit as name it sends submit.x submit.y instead of that name php $_POST replaces submit.x submit.y to submit_x and submit_y if (isset($_POST["submit_x"]) || isset($_POST["submit_y"])) { would make code work 100% Quote Link to comment Share on other sites More sharing options...
signature16 Posted February 17, 2007 Author Share Posted February 17, 2007 This is what I have set right now: @ssoke: Can you clarify. I'm not quite sure what you mean. Sorry. //If we got a post, process it. if ($_POST['submit']) { update_submit_location(); //Initialize local vars to make reading easier on the eyes and cleaner code $address = addslashes($_POST['street']); $city = addslashes($_POST['city']); $state = addslashes($_POST['state']); $zip = addslashes($_POST['zip']); $storename = addslashes($_POST['storename']); $hours = addslashes($_POST['hours']); $url = addslashes($_POST['url']); $notes = addslashes($_POST['notes']); $image = addslashes($_POST['image']); $image_url = addslashes($_POST['image_url']); $phone = addslashes($_POST['phone']); $use_coordinate = addslashes($_POST['use_coordinate']); $icon = addslashes($_POST['icon']); $emailConfirm = addslashes($_POST['emailConfirm']); $coordinates = get_lat_lon($_POST, ''); $coordinates = split('##', $coordinates); Quote Link to comment Share on other sites More sharing options...
sspoke Posted February 17, 2007 Share Posted February 17, 2007 replace if ($_POST['submit']) to if (isset($_POST["submit_x"]) || isset($_POST["submit_y"])) Quote Link to comment Share on other sites More sharing options...
signature16 Posted February 17, 2007 Author Share Posted February 17, 2007 sspoke: thank you so much. worked perfectly!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.