PHP Help

Status
Not open for further replies.

kbjradmin

New Member
Messages
512
Reaction score
2
Points
0
i am making a php page to make it easier to configure a contact form, but it doesn't want to work.

i've been looking at this code for a long time, and am not getting very far. please help.

http://kbjr.x10hosting.com/templates/unp_template/info/contact

PHP:
<?php

$input_type = array();
$input_name = array();
$input_text = array();
$radio_text = array();
$radio_value = array();

#####################################################################################################################################
#####                                                 START EDITING HERE                                                        #####
#####################################################################################################################################


/*
THE FOLLOWING REFERS TO THE CONTACT INDEX PAGE.
EACH OF THESE ARE INPUT FORMS.
INPUT_NUM IS THE NUMBER OF INPUT FORMS USED.
INPUT_TYPE IS THE TYPE OF THE INPUT ( TEXT, MESSAGE, OR RADIO ).
INPUT_NAME IS THE NAME OF THE INPUT IN THE CODE, NOT THE DISPLAYED TEXT.
INPUT_TEXT IS THE TEXT DISPLAYED TO INFORM THE USER OF THE DATA REQUESTED.
FOR RADIO TYPES, YOU ALSO WILL BE REQUIRED TO ADD THE VARIABLES $radio_num[#], $radio_value[##] AND $radio_text[##] AS SHOWN BELOW AS EXAMPLE FOUR.
IN RADIO_VALUE AND RADIO_TEXT, THERE ARE TWO NUMBERS IN THE BRACKETS AS OPPOSED TO ONE.
THE FIRST IS THE NUMBER OF THAT INPUT, SAME AS THE OTHERS, AND THE OTHER IS THE NUMBER OF THE RADIO OPTION.
*/

$input_num = 7;

// input one
$input_type[1] = "text";
$input_name[1] = "name";
$input_text[1] = "Name: ";

// input two
$input_type[2] = "text";
$input_name[2] = "email";
$input_text[2] = "Email: ";

// input three
$input_type[3] = "text";
$input_name[3] = "subject";
$input_text[3] = "Subject: ";

// input four
$input_type[4] = "radio";
$input_name[4] = "reason";
$input_text[4] = "Reason For Message: ";
$radio_num[4] = "3";
$radio_value[41] = "question";
$radio_text[41] = "Question";
$radio_value[42] = "comment";
$radio_text[42] = "Comment";
$radio_value[43] = "other";
$radio_text[43] = "Other";

// input five
$input_type[5] = "message";
$input_name[5] = "message";
$input_text[5] = "Message:\n";

// input six
$input_type[6] = "submit";
$input_text[6] = "Submit";

// input seven
$input_type[7] = "reset";
$input_text[7] = "Reset";


#####################################################################################################################################
#####                                                 STOP EDITING HERE                                                         #####
#####################################################################################################################################

// start contact code
$contact_code = "<div id=\"contact\">\n<form action=\"send.php\" method=\"post\">\n";

// proccess contact data and append to contact code
$x = 1;

while($x<=$input_num){

if($input_type[$x]="radio"){
$contact_store = "<p class=\"input\">$input_text</p>";
$n = 1;
while($n<=$radio_num[$x]){
$v = $x.$n;
$contact_store = $contact_store."\n<p class=\"radio\">$radio_text[$v] <input type=\"radio\" name=\"$input_name[$x]\" value=\"$radio_value[$v]\" /></p>";
$n++;
}
$contact_code = $contact_code.$contact_store;
$x++;    
}

if($input_type[$x]="text"){
$contact_store = "<p class=\"input\">$input_text[$x]<input type=\"text\" name=\"$input_name[$x]\" /></p>\n";
$contact_code = $contact_code.$contact_store;
$x++;    
}

if($input_type[$x]="message"){
$contact_store = "<p class=\"input\">$input_text[$x]<input type=\"text\" name=\"$input_name[$x]\" /></p>\n";
$contact_code = $contact_code.$contact_store;
$x++;    
}

if($input_type[$x]="submit"){
$contact_store = "<a href=\"submit();\" class=\"submit\">Submit</a>\n";
$contact_code = $contact_code.$contact_store;
$x++;    
}

if($input_type[$x]="reset"){
$contact_store = "<a href=\"reset();\" class=\"reset\">Reset</a>\n";
$contact_code = $contact_code.$contact_store;
$x++;    
}

}

// end contact code
$contact_code = $contact_code."</form></div>";

?>
</div>
 

natsuki

New Member
Messages
112
Reaction score
0
Points
0
maybe you meant
PHP:
if($input_type[$x] == "radio")
instead of = which is an assignment operator... other than that can you post the error?
 
Last edited:

natsuki

New Member
Messages
112
Reaction score
0
Points
0
nice to know it's solved^^
If you need some more help just feel free to ask.
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Since the issue is solved, i am closing this thread.
The author can reopen the thread anytime for further help.
 
Status
Not open for further replies.
Top