You are here: Re: form values to multiple .php files?? « All PHP « IT news, forums, messages
Re: form values to multiple .php files??

Posted by needaticker on 10/13/22 11:26

This is a crazy problem.
I'm working on vBulletin the php forums software, and the problem that
I'mm finding is that I have to adjust regular php to fit into templates
and so if there was a way to get the values to shoot off into the other
files then this would solve my problem

(btw the myfile.php proceses the data then redirects depending on the
results. One of the directs is to a mobilewrong.php page the other is
to a commentblank.php page. I am trying to drag the entered details
into these forms so that the site visitor wont have to re enter the
details.


I'm sure that there are easier ways to do this.




Summarizing what I want to do from the start:

1. I have a form with 4 fields. For example $mobile, $code, $message,
$tickbox

2. I need to confirm that there are no blank values and that the
tickbox is ticked.

3. I need to confirm that $mobile is a number (no other characters)

4. If there are blank values or $mobile contains a value other than a
number, I need error messages and the form to be presented back to them
with the error messages below.

5. Another tricky part is that I need $code to be checked, so that it
is matched to a code in mysql database. Otherwise the user gets
requested to re-enter the code (but hopefully the message and mobile
fields will still be populated from what the user originally put in
each of the fields. This will stop them getting annoyed that the
message they spent 10 mins writing has disappeared after the error.

6. If there are no blanks AND the code matches any code on mysql (I
have a table there with a single field which has 1000 codes) AND the
mobile value is all numbers, then and only then would I like myfile.php
to be actioned which involves sending an email (I have the email bit
all worked out in the myfile.php)


7. The final bit is that on submission If all the above is correct (no
blanks and code confirmed etc...) then I need the code to be deleted
from the mysql table.


I know that this is quite a bit of work but if anyone could help me
with anybit then I would appreciate it.


At the moment I might be doing it the wrong way but have this:



<?php


//substr just to have the php page accept a certain number of
characters, not all that important.

$mobile = substr($_REQUEST["mobile"], 0, 15);
$code = substr($_REQUEST["code"], 0, 8);
$message = substr($_REQUEST["message"], 0, 122);
$tickbox = $_REQUEST["tickbox"];


//will redirect to blanks.php page which is almost the same as the
original form page,
//but with the blanks error message

if (empty(mobile) || empty($code) || empty($message) ||
empty($tickbox)) {
header( "Location: http://www.mysite.com/blanks.php" );

}

//will redirect to bad number page which is almost identical to the
original form page
//but with bad number comment
if (!ereg("^[0-9]{1,}$",$mobile)) {
header( "Location: http://www.mysite.com/badnumber.php" );

}


//the bit that sends the email
//this bit works and so i dont need help on the actual email send
$my_email = "xxxxxx@xxxxxx.com";


if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}

$message = "";



while(list($key,$value) =
each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key:
$value\n\n";} if($set!==1){header("location:
$_SERVER[HTTP_REFERER]");exit;}

$message = "$code
$mobile
$message
$tickbox";



$subject = "subject";
$headers = "From: " . $_POST['senderemail'] . "\n" . "Return-Path: " .
$_POST['senderemail'] . "\n" . "Reply-To: " . $_POST['senderemail'] .
"\n";

mail($my_email,$subject,$message,$headers);


<html>
<head>
</head>
<body>

Actual final page that the user sees after successful form submission
is here in the html.


</body>
</html>


?>

So thats how far I've come with separate .php files for error messages.

But I do need to only have this form submit the email bit if there are
no blanks AND the $mobile only contains numbers AND the $code matches a
code in mysql table.

On submission I would need the used code to be deleted from the table
on mysql.


Please help!!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация