My PHP Code Is Not Working Correctly Can Anyone Help?
Hi,
I hope that you all are having agreat day. I am looking for some help getting this php code to wrk for me properly. Maybe someone here can help me as I am a novice to any type of coding. I am often in need ofa helping hand.
The code that I am showing here is supposed to redirect the user to a certain web page (salesletters) of three different ones or one default page if they should choose the "other" option .
1. After being shown a question to answer the user clicks on one of option A.) option B.) or option C.) from a pull down menu or enter some information into a "other" box.
2. The user clicks on a submit button that sends their information, (name, email) to my autoresponder.
3.The autoreponder then redirects the user to my main.php page where my php code is supposed to choose and show the correct page for the selection the user has chosen. It is also supposed to personalize this page by adding the users first name to this page.
The problem that I am having is that the only page out of the 4 that I can get to show is the default page (other option page) no matter what selection is chosen A.) B.) or C.) The default page "other" always displays. I would like to know if it is the .php code that is to blame or maybe some other problem in my set up. Here is the code on my main.php:
wirehopper, Thank you very much for your response and help. I am sad to say that I do not know php coding at all. I think I need more help. :-( Because thae $_REQUEST array includes cookies is this the reson that the code is not working propely. So where in the code would I put the echo commands and what should I then expect or look for?
I also looked at the referrences that you included. Now know how rewally limeted I am. Could you please help me further to unerstand what I need to do to get this code to work properly? I would be truly greatful.
I'm not sure exactly what you are trying to do, or what the form that submits to this script looks like. I tried to clean it up to repair a few problems, but it may not work on the first try. I would run this script while keeping the original as a backup.
PHP Code:
<?php //don't really need the next line as you are not using sessions. session_start(); $name=$_REQUEST["name"]; $other=$_REQUEST["other"]; $mainquestion=$_REQUEST["mainquestion"]; $today=time(); $today=date("Y-m-d",$today); $ip=$_SERVER["REMOTE_ADDR"];
//not using session, and session_register is depreciated as well. // $letterused=$mainquestion; // session_register("letterused"); // $campused=$campaign; // session_register("campused");
I want to thank you Jcbones for your help. The people here have been absolutely oustanding in the help that they provide. I only hope that i will be able to return the help to someone else in need one day. Thank you again for your help I will try the edited code and let yo know what happens.
Jcbones, I tried the revised php code and there has been no change in how it preforms. I am beginning to think that it must be something more than the php code causing the program not to run properly. If you or any one else here has any other ideas or advice it is welcome. Thank you so much again for your time, effort and help.
if(empty($other)) { $fieldname="other"; //I do not know what fieldname is, as it isn't passed or declared. $mainquestion="other"; }
//REPLACE THE "CASE" STRING WITH THE NAME OF YOUR SCRIPTS. //switch is used for sanitation so someone cannot access files they are not suppose to. switch($mainquestion) { case 'page1': $file = 'page1.html'; break; case 'page2': $file = 'page2.html'; break; case 'page3': $file = 'page3.html'; break; default: $file = 'default.html'; }
Jcbones, I am very greatful to you for the time you have put into this project. I can't thank you enough. i have a question. Would my submission script be my user opt-in page where the "main question" is found? or would it be my "letters folder" where my three salesletters plus the default sales letter is located? How this program is set up is that all of my .php pages(admin.php, paging.php, salesletterbuilderaweber.php. etc.) plus 2 folders Images, and letters. In the letters folder are my 3 salesletters plus the default. My main.php where the code you are helping me with is located in the main website root directory. Do you think that the way this is set up will have any bearing on how the script is performining?
In any case I should put in the names of my .html salesletters?
I am including my opt-in form page .html. I hope this helps.
Code:
</head>
<body background="sasonlineback.png" bgcolor="#e13926" (16).jpg="">
<table border="8" cellspacing="0" cellpadding="0" width="800" align="center">
<tbody>
<tr>
<td valign="undefined" align="undefined"><img title="" alt="" width="800" height="500" src="../../images/sasonlinebusinesslogo.jpg"></td></tr></tbody></table><br>
<table border="8" cellspacing="0" cellpadding="12" width="800" align="center">
<tbody>
<tr>
<td class=" wproHighlight" bgcolor="#999999" valign="undefined" align="undefined">
<p align="center"><big><big><font size="6"><font color="#0000cc"><font face="Arial"><strong>SAS Online Business Success Is A Host Of Online Businesses That Can Help You With All Of Your Online Home Business Help From Start To Finish!</strong> <br>
</font></font></font><br>
</big></big><font color="#ffffff" face="Arial"></font><font face="Arial">
<p align="center">
<table style="width: 500px; border-collapse: collapse" border="1" cellspacing="0" bordercolor="#000000" cellpadding="10" bgcolor="#0066ff" align="center">
<tbody>
<tr valign="top">
<td width="100%">
<p align="center">
<form method="post" action="http://www.aweber.com/scripts/addlead.pl">
<p align="center"><strong><font color="#ff0000" size="5">GET FREE INTERNET MARKETING NEWSLETTER</font></strong></p>
<p><strong>For More Infomation and to <font color="#000000">get your free monthly internet marketing newsletter full of <u>useful tips</u>, <u>interesting information</u> and <u>online home business help topics</u> </font></strong><font color="#000000"><font color="#ffffff">Sign Up </font><u><em><strong><font color="#cc0000">Now!</font></strong></em></u></font></p>
<p align="center">Please Enter Your Name And Primary Email Address Below</p>
<p align="center"><font size="2" face="Verdana"><font size="3">First Name:</font><br>
<input name="name">
<p align="center"><font size="3">Email:<br>
</font><input name="from">
<p align="center"><font size="3"><strong>What Kind of Help Are You Looking for With Your Online Home Business?</strong> </font></font>
<p align="center"><select name="mainquestion">
<option selected="selected" value="business">Help Starting Your Online Home Business?</option>
<option value="products">Getting Hot Digital Products For Online Business Help or Sales of 100% Profit?</option>
<option value="affiliates">Help With Affiliates Or Affiliate Marketing Projects</option></select></p>
<p><input value="1" type="hidden" name="campaign"> <input value="mainquestion" type="hidden" name="fieldname">
<p align="center"><font size="2" face="Verdana"><font size="3">If Other, please specify</font>:</font><br>
<p align="center"><textarea rows="10" cols="40" name="other"></textarea> </p>
<p align="center"><input value="905977818" type="hidden" name="meta_web_form_id"> <input type="hidden" name="meta_split_id"> <input value="conversionninja" type="hidden" name="listname"> <input value="http://www.sasonlinebusinesssuccess.com/main.php" type="hidden" name="redirect">
<p align="center"><font color="#ffffff">SAS Online Business Success values your privacy</font></p>
<p align="center"><font color="#ffffff">Your information will be held totally confidential</font></p>
<p align="center"><input value="submit" type="submit" name?submit?> </td></tr></tbody></table>
<p align="center"></font>
<p align="center"><big><big><font face="Arial">When You Need Help As We All Do... Please Turn To SAS Online Business Success!!!</font></big></big></p>
<p align="center"><big><big><font size="3"><a title="" target="_blank" href="../../Privacy.html"><font color="#000000">Privacy</font></a><font color="#000000"> | </font><a title="" target="_blank" href="../../sasonlinebusinesssuccessdisclaimer.html"><font color="#000000">Disclaimer</font></a><font color="#000000"> | </font><a title="" target="_blank" href="../../TermsOfUse.html"><font color="#000000">Terms Of Use</font></a></font></big></big></p></td></tr></tbody></table><br>
<div align="center"></div></form>
</body>
</html>